Getting User Info in a Domain

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
Dennis,

I have the exact answer for you but as you didn't want my help in the past when
I asked specific questions you can get help somewhere else
 
Thank you for your BS!
--
Dennis in Houston


Newbie Coder said:
Dennis,

I have the exact answer for you but as you didn't want my help in the past when
I asked specific questions you can get help somewhere else
 
Dennis,

I have a long memory with what you said in the past & will never help you again
even when I have the exact code you need. You only have yourself to blame
 
Newbie,

As we all remember what somebody has written about us, whoever it is, then
they can better close all newsgroups.

However feel free to sustain in your behaviour.

Cor
 
Dennis said:
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

Does the home network have a domain controller or are the computers
configured as standalone in a workgroup?
 
Dennis said:
Standalone in a workgroup as a home network on a router.

You can try the following to see if it works any better:
select * from win32_localhost where localaccount = true
 
Back
Top