Hmm .. well, what I trying to solve is this: we have software that is
installed into 2 different folders - Live and Training. It's the same
executable name, it's just that each one points to a different
database.

So filtering for just the exe name brings me info on both Live and
Training. And I only want Live ...

So filtering this way gives me \Live\This.exe as well as \Training\this.exe

On Fri, Oct 3, 2014 at 12:41 PM, Daniel Ratliff <dratl...@humana.com> wrote:
> This works.
>
> Get-WmiObject -class win32_process -filter "ExecutablePath like '%calc.exe'"
>
> It seems like a limitation of that class and the Path and ExecutablePath 
> properties. It does not work in wbemtest or PowerShell.
>
> Daniel Ratliff
>
>
> -----Original Message-----
> From: listsad...@lists.myitforum.com [mailto:listsad...@lists.myitforum.com] 
> On Behalf Of Daniel Ratliff
> Sent: Friday, October 03, 2014 12:36 PM
> To: powershell@lists.myitforum.com; ntsys...@lists.myitforum.com
> Subject: RE: [powershell] Get-WmiObject question on filtering
>
> Not working for me either, filters on other properties work fine. Still 
> testing...
>
> Daniel Ratliff
>
> -----Original Message-----
> From: listsad...@lists.myitforum.com [mailto:listsad...@lists.myitforum.com] 
> On Behalf Of Michael Leone
> Sent: Friday, October 03, 2014 12:25 PM
> To: powershell@lists.myitforum.com; ntsys...@lists.myitforum.com
> Subject: [powershell] Get-WmiObject question on filtering
>
> I want to try a Get-WmiObject that uses a Filter for executable path.
> But it's failing. If I filter for just the name of the exe I want, it works.  
> And one of the properties returned is ExecutablePath
>
> ExecutablePath             Property       string ExecutablePath {get;set;}
>
> and that property gives me what I want:
>
> C:\Windows\system32\calc.exe
>
> So why can't I do this?
>
> PS C:\Windows\system32> $a=(Get-WmiObject -Class win32_process -ComputerName 
> "xxxx" -Filter
> "ExecutablePath='C:\Windows\system32\calc.exe'")
> $a
>
> Get-WmiObject : Invalid query "select * from win32_process where 
> ExecutablePath='C:\Windows\system32\calc.exe'"
> At line:1 char:5
> + $a=(Get-WmiObject -Class win32_process -ComputerName "DCTRRDS003"
> -Filter "Execu ...
> + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> + ~~~~~~~~~~
>     + CategoryInfo          : InvalidArgument: (:) [Get-WmiObject],
> ManagementException
>     + FullyQualifiedErrorId :
> GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
>
>
> ================================================
> Did you know you can also post and find answers on PowerShell in the forums?
> http://www.myitforum.com/forums/default.asp?catApp=1
>
>
> The information transmitted is intended only for the person or entity to 
> which it is addressed and may contain CONFIDENTIAL material.  If you receive 
> this material/information in error, please contact the sender and delete or 
> destroy the material/information.
>
> ================================================
> Did you know you can also post and find answers on PowerShell in the forums?
> http://www.myitforum.com/forums/default.asp?catApp=1
>
> The information transmitted is intended only for the person or entity to 
> which it is addressed
> and may contain CONFIDENTIAL material.  If you receive this 
> material/information in error,
> please contact the sender and delete or destroy the material/information.
>
> ================================================
> Did you know you can also post and find answers on PowerShell in the forums?
> http://www.myitforum.com/forums/default.asp?catApp=1


================================================
Did you know you can also post and find answers on PowerShell in the forums?
http://www.myitforum.com/forums/default.asp?catApp=1

Reply via email to