G
Guest
I am trying to get all the user info in my home network domain using WMI but
the below code returns nothing. I know the domain name I pass is correct,
i.e., "mshome". I cut and pasted this code from an example I found on the
internet.
Public Shared Function GetUsersInfoCollection(ByVal domain As String) As
ManagementObjectCollection
Dim query As ManagementObjectSearcher
Dim queryCollection As ManagementObjectCollection
Dim msc As ManagementScope = New ManagementScope("root\cimv2")
Dim query_command As String = "SELECT * FROM Win32_UserAccount
WHERE Domain=" & Chr(34).ToString() & domain & Chr(34).ToString()
Dim select_query As SelectQuery = New SelectQuery(query_command)
query = New ManagementObjectSearcher(msc, select_query)
queryCollection = query.Get()
Return queryCollection
End Function
the below code returns nothing. I know the domain name I pass is correct,
i.e., "mshome". I cut and pasted this code from an example I found on the
internet.
Public Shared Function GetUsersInfoCollection(ByVal domain As String) As
ManagementObjectCollection
Dim query As ManagementObjectSearcher
Dim queryCollection As ManagementObjectCollection
Dim msc As ManagementScope = New ManagementScope("root\cimv2")
Dim query_command As String = "SELECT * FROM Win32_UserAccount
WHERE Domain=" & Chr(34).ToString() & domain & Chr(34).ToString()
Dim select_query As SelectQuery = New SelectQuery(query_command)
query = New ManagementObjectSearcher(msc, select_query)
queryCollection = query.Get()
Return queryCollection
End Function