3
1
In powershell I can do a query like
> get-wmiobject -query 'select * from win32_groupuser' | % {[wmi]$_.partcomponent|select domain,name,SID}
Which will list for each wmi, the domain, name and sid for each user.
How would I accomplish this using vbscript?
I currently use execquery
:
Dim strComputer, objWMIService
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\"& strComputer & "\root\cimv2")
objWMIService.ExecQuery("select partcomponent,groupcomponent from win32_groupuser")
for the first part, but how do I incorporate the equivalent of | % {[wmi]$_.partcomponent|select domain,name,SID}
Alternatively, how could I do
gwmi win32_groupuser | % { [wmi]$_.partcomponent | select domain,name,sid}
using vbscript; as it is not a query, I cannot use execquery
, but it has the same output as the original query.