Hi Everybody,
I use Powershell and WMI for many different purposes. But today I got in trouble with filtering on the Win32_GroupUser Class:
$query = "select PartComponent from Win32_groupuser where GroupComponent like '%Administrator%'"
Get-WmiObject -Computername "mycomputer.fq.dn" -Query $query
But then I got the Error:
Get-WmiObject : Invalid query "select PartComponent from Win32_groupuser where Path like '%Administrator%'"
At line:3 char:1
+ Get-WmiObject -Computername "mycomputer.fq.dn" -Query $query
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-WmiObject], ManagementException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
When I delete the filter and just run:
$query = "select PartComponent from Win32_groupuser"
The output is just fine..
On the Win32_Process Class I discovered:
$query = "select * from win32_process where Name like '%exe%'"
is running fine and gives me all the .exe processes...
while this query wont work:
$query = "select * from win32_process where Path like '%exe%'"
resulting in the same error above.
When I remove the filter, everything is just fine again..
Has anyone ever found a solution for this or the cause? It seems like it happens on all OS (I tried Win7, SRV 2008R2, 2012, 2012R2..
Thank you in advance!