On Fri, Oct 3, 2014 at 2:55 PM, Mote, Todd <[email protected]> wrote:
> For posterity, what was the final format of the filter? > First, I saved the actual executable path as a version with 2 slashes instead of one. Then fed that to into Get-WmiObject $OneSlash = "\" $TwoSlash = "\\" $RA_FilePath = $RemoteApp.FilePath.Replace($OneSlash, $TwoSlash) . . . . $RunningApps = (Get-WmiObject -Class Win32_Process -ComputerName $SessionHost -Filter "ExecutablePath='$RA_FilePath'") *From:* [email protected] [mailto: > [email protected]] *On Behalf Of *Michael Leone > > *Sent:* Friday, October 3, 2014 1:36 PM > *To:* [email protected] > *Cc:* [email protected] > *Subject:* Re: [NTSysADM] RE: [powershell] Get-WmiObject question on > filtering > > > > OK! So using the correct -Filter on the Get-WmiObject (as opposed to > piping the output to a PS "Where" statement) cut down execution time from > approx 52 seconds to 40 seconds (which is approx 20%). Not too shabby ... > maybe I can tweak the rest of the script ... > > > > On Fri, Oct 3, 2014 at 12:57 PM, Michael Leone <[email protected]> > wrote: > > > > > > On Fri, Oct 3, 2014 at 12:50 PM, Crawford, Scott <[email protected]> > wrote: > > You need to escape the backslashes, like so: > > Get-WmiObject -Class win32_process -Filter > "ExecutablePath='c:\\windows\\system32\\calc.exe'" > > > > AH. OK, I will try that. Thanks! > > > > >

