Getting User Info in a Domain

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
 
N

Newbie Coder

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
 
G

Guest

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
 
N

Newbie Coder

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
 
C

Cor Ligthert[MVP]

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
 
N

Nick

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?
 
N

Nick

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top