473,385 Members | 1,324 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Getting User Info in a Domain

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 in Houston
Sep 22 '07 #1
9 1599
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

--
Newbie Coder
(It's just a name)
"Dennis" <De****@discussions.microsoft.comwrote in message
news:C7**********************************@microsof t.com...
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 in Houston

Sep 22 '07 #2
Thank you for your BS!
--
Dennis in Houston
"Newbie Coder" wrote:
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

--
Newbie Coder
(It's just a name)
"Dennis" <De****@discussions.microsoft.comwrote in message
news:C7**********************************@microsof t.com...
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 in Houston


Sep 23 '07 #3
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 Coder
(It's just a name)

"Dennis" <De****@discussions.microsoft.comwrote in message
news:B3**********************************@microsof t.com...
Thank you for your BS!
--
Dennis in Houston
"Newbie Coder" wrote:
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

--
Newbie Coder
(It's just a name)
"Dennis" <De****@discussions.microsoft.comwrote in message
news:C7**********************************@microsof t.com...
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 in Houston

Sep 23 '07 #4
Dennis,

WMI gives you information about your computer, LDAP gives it about the
active directory.
Beside that you can get some information using the environment class. (by
instance username).

In your case I would start here

http://msdn2.microsoft.com/en-us/lib...8a(vs.71).aspx
Cor
"Dennis" <De****@discussions.microsoft.comschreef in bericht
news:C7**********************************@microsof t.com...
>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 in Houston
Sep 23 '07 #5
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

Sep 23 '07 #6
Cor, thanks for info site. I'll check it out.
--
Dennis in Houston
"Cor Ligthert[MVP]" wrote:
Dennis,

WMI gives you information about your computer, LDAP gives it about the
active directory.
Beside that you can get some information using the environment class. (by
instance username).

In your case I would start here

http://msdn2.microsoft.com/en-us/lib...8a(vs.71).aspx
Cor
"Dennis" <De****@discussions.microsoft.comschreef in bericht
news:C7**********************************@microsof t.com...
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 in Houston
Sep 23 '07 #7
"Dennis" <De****@discussions.microsoft.comwrote in message
news:C7**********************************@microsof t.com...
>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 in Houston
Does the home network have a domain controller or are the computers
configured as standalone in a workgroup?
Sep 24 '07 #8
Standalone in a workgroup as a home network on a router.
--
Dennis in Houston
"Nick" wrote:
"Dennis" <De****@discussions.microsoft.comwrote in message
news:C7**********************************@microsof t.com...
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 in Houston

Does the home network have a domain controller or are the computers
configured as standalone in a workgroup?
Sep 25 '07 #9
"Dennis" <De****@discussions.microsoft.comwrote in message
news:05**********************************@microsof t.com...
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
Sep 25 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Buddy Ackerman | last post by:
I have an application where the client wants AD integration. The application requires that the user accounts reside in the app's database. The application is a (.NET) webservices based app where...
3
by: mrwoopey | last post by:
Hi, I am using the example "Authenticate against the Active Directory by Using Forms Authentication and Visual Basic .NET": http://support.microsoft.com/default.aspx?scid=KB;EN-US;326340 ...
2
by: Scott M. Lyon | last post by:
I'm having some strange problems with a VB.NET application that I support. The application currently uses SystemInformation.UserName() and SystemInformation.UserDomainName() to determine who is...
5
by: tjonsek | last post by:
I am trying to pull the user logon info in an asp.net application to use as a security stamp when someone completes a function. So far, I am able to retrieve the computer name. This is, however,...
18
by: Arthur | last post by:
Hi All, I would like to get the name of the user given their networkID, is this something Active Directory would be useful for?(For intranet users) If so, can you please point me to some sample...
5
by: Tom | last post by:
I have a function that restricts access to a page to logged in users. When a user who isn't logged in goes to the page, it will dynamically generate a login form. I'm trying to use it in...
0
by: kkos | last post by:
I noticed the following issue posted as a double-hop issue in many discussion boards but found no answers that explain how to pass the second hop with windows auth from IIS ASPX page to remote SQL...
0
by: Isaiah | last post by:
Ok, I have a small issue remaining, and have no idea how to resolve... We are on a secure domain, and I have setup IIS to authenticate users from our domain and log them... Under the IIS...
5
by: Michael Howes | last post by:
I'm writing a utility to manage a machines *local* accounts in c# I am getting all the users in a specific Group just fine but when I want to get some of the information on each user from their...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.