Quantcast
Channel: PowerShell.org » All Posts
Browsing all 13067 articles
Browse latest View live

Exclude results of a compare-object if they meet a specific criteria

I am using the Compare-object command to compare a CSV file. I am successfully using this to find the difference between two csv files: compare-object $yesterdays $todays -Property EMPLID,GROUP_NAME...

View Article


Reply To: Exclude results of a compare-object if they meet a specific criteria

If you could create a runnable sample (I guess what’s missing would be a string for $yesterday and a string for $today, where the strings shows of the different cases you’ve identified), it would make...

View Article


quick question – basic script – combine two commands

All, new at all the scripting things and I am missing a basic step I hope you can clue me in on. I am using VmWare Powercli, but I am 99% sure this is basic Powershell that applies to all users. So...

View Article

Reply To: quick question – basic script – combine two commands

This is written without being able to test it, so there might of course be a spelling error or two, but I believe something along the lines of the following should work: Get-Cluster "Cluster" | Get-VM...

View Article

Partial string match on a list

I am using the script from http://cloudtidings.com/2010/08/03/dpm-2010-powershell-script-to-auto-protect-vms-as-they-get-added-to-a-csv-cluster/ to auto add new VM’s to my DPM Protection Group. I need...

View Article


Reply To: Partial string match on a list

There are several ways. One approach I’ve used for this kind of thing in the past is to convert the array into a single regex, which can be used with the -match or -notmatch operators: $VMsToIgnore =...

View Article

Image may be NSFW.
Clik here to view.

Reply To: Installing .MSU Via Powershell & PSexec

Hey Peter Well I definitely don’t have any issues with my connection to these machines however I did all what you said and connected via RDP to the machine and ran the command locally from PS session...

View Article

Generate alert XML

Hi Guys, Im new on generating XML. So i hope somebody can help me. Here i got different XML elements and attributes (see below). How do i generate something like this in powershell and save it to a...

View Article


Reply To: Generate alert XML

Quick question, in what format is your source data? Is it also im XML? Or will you get the data from other sources? I.e. is that you are asking how to generate the XML document above with values...

View Article


Access an existing mapped drive

Hi Using PS 4.O. I am using a mapped ‘home’ drive (T:) to store my scripts so that they are backed up nightly. When I set my default location to this drive using Set-Location T:\Scripts cmdlet I get...

View Article

Reply To: Installing .MSU Via Powershell & PSexec

My apologies I forgot to mention that you must have CredSSP enabled in your environment in order to access a network share from a remote machine. This involves running Enable-WSManCredSSP on the...

View Article

Reply To: Installing .MSU Via Powershell & PSexec

oh come onnnn… what’s wrong with the code tags?!?!

View Article

Reply To: Exclude results of a compare-object if they meet a specific criteria

The bottom line is you will need to use methods before the compare to remove the rows you don’t want to see in your results. I don’t know of any parameters on the compare-object CMDLET that would help...

View Article


Reply To: Generate alert XML

My output is XML and my input is a operations manager message what i must add in the MSG element. So there is an alert in opsmgr and that starts a powershell script that generates and XML (like above)...

View Article

Reply To: Need help with Powershell Command

Hi Greg, Thank you for reply. I am getting the following error while excuting the command. PS C:\Users\db2admin> (db2 get dbm cfg | select-string -Pattern DIAGPATH|? {-not($_ -match...

View Article


Get-Service -ComputerName in PSSession (require other privileges)

Hi I can successfully create a remote session using Enter-PSSession to a server SRV_A from a computer MyComputer. Inside this session if I execute the cmdlet Get-Service -ComputerName ComputerB, I get...

View Article

Reply To: Get-Service -ComputerName in PSSession (require other privileges)

You’re running into the “double hop” problem, as described in “Secrets of PowerShell Remoting.” Your credential delegates when you remote to SRV_A. However, once there, your credential cannot (by...

View Article


Image may be NSFW.
Clik here to view.

Reply To: Need help with Powershell Command

Hi Hamid, I was actually expecting to see a post of Dave’s, since he is a Regex expert But maybe I can help you too: $a = "Diagnostic data directory path (DIAGPATH) = c:\users\db2admin\" $null = $a...

View Article

Reply To: Exclude results of a compare-object if they meet a specific criteria

Ok here is a working code sample: $today = [DateTime]::Today.ToString("MM-dd-yyyy") $yesterday = [DateTime]::Today.AddDays(-1).ToString("MM-dd-yyyy") $yesterdays = Import-Csv -Path ($yesterday...

View Article

Reply To: Access an existing mapped drive

To get it not to show the output of the New-PSDrive you could just pipe it to Out-Null, so you’d get: New-PSDrive -Name T -PSProvider FileSystem -Root "\\Lincoln\Data\Tony Wainwright" | Out-Null...

View Article
Browsing all 13067 articles
Browse latest View live