Hello,
I have a need to use WMI to query the use information from a group either in the domain or in a computer.
I tried the following WMI query, but it failed with (null): 0x8004103A.
Is it possible to use ASSOCIATORS OF query to get the user name and full name with WMI query?
strDomain = "MYDOMAIN"
strGroup = "Mygroup"
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
strQuery = "ASSOCIATORS OF {Win32_Group.Domain = '" & strDomain & "',Name='" & strGroup & "'} " & _
"WHERE ResultClass = Win32_UserAccount"
Set colItems = objWMIService.ExecQuery(strQuery)
For Each objItem in colItems
Wscript.Echo objItem.Name
Next
Thanks.
I have a need to use WMI to query the use information from a group either in the domain or in a computer.
I tried the following WMI query, but it failed with (null): 0x8004103A.
Is it possible to use ASSOCIATORS OF query to get the user name and full name with WMI query?
strDomain = "MYDOMAIN"
strGroup = "Mygroup"
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
strQuery = "ASSOCIATORS OF {Win32_Group.Domain = '" & strDomain & "',Name='" & strGroup & "'} " & _
"WHERE ResultClass = Win32_UserAccount"
Set colItems = objWMIService.ExecQuery(strQuery)
For Each objItem in colItems
Wscript.Echo objItem.Name
Next
Thanks.