I have this command
$remoteuserlist = Get-WmiObject Win32_UserAccount `
-filter "LocalAccount =True" –computername $PC -verbose
that I am running to get a list of local accounts on a machine. I would also like to exclude the guest account from my list. so I tried something like this
$remoteuserlist = Get-WmiObject Win32_UserAccount `
-filter {LocalAccount =True -and Name -ne "Guest" –computername $PC -verbose}
but I get an invalid query error. Can someone explain my presumably blindingly obvious error?
Thanks
If you have a bunch of old VBScript WMI queries laying around you can use the Get-WMIObject -Query param to reuse them.
Not groundbreaking but it can help if you don't want to rewrite queries.
The WQL "not equal" operator is != or <>.
WQL Operators
Get-WmiObject