473,805 Members | 2,074 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 GetUsersInfoCol lection(ByVal domain As String) As
ManagementObjec tCollection
Dim query As ManagementObjec tSearcher
Dim queryCollection As ManagementObjec tCollection
Dim msc As ManagementScope = New ManagementScope ("root\cimv2 ")
Dim query_command As String = "SELECT * FROM Win32_UserAccou nt
WHERE Domain=" & Chr(34).ToStrin g() & domain & Chr(34).ToStrin g()
Dim select_query As SelectQuery = New SelectQuery(que ry_command)
query = New ManagementObjec tSearcher(msc, select_query)
queryCollection = query.Get()
Return queryCollection
End Function
--
Dennis in Houston
Sep 22 '07 #1
9 1615
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****@discuss ions.microsoft. comwrote in message
news:C7******** *************** ***********@mic rosoft.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 GetUsersInfoCol lection(ByVal domain As String) As
ManagementObjec tCollection
Dim query As ManagementObjec tSearcher
Dim queryCollection As ManagementObjec tCollection
Dim msc As ManagementScope = New ManagementScope ("root\cimv2 ")
Dim query_command As String = "SELECT * FROM Win32_UserAccou nt
WHERE Domain=" & Chr(34).ToStrin g() & domain & Chr(34).ToStrin g()
Dim select_query As SelectQuery = New SelectQuery(que ry_command)
query = New ManagementObjec tSearcher(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****@discuss ions.microsoft. comwrote in message
news:C7******** *************** ***********@mic rosoft.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 GetUsersInfoCol lection(ByVal domain As String) As
ManagementObjec tCollection
Dim query As ManagementObjec tSearcher
Dim queryCollection As ManagementObjec tCollection
Dim msc As ManagementScope = New ManagementScope ("root\cimv2 ")
Dim query_command As String = "SELECT * FROM Win32_UserAccou nt
WHERE Domain=" & Chr(34).ToStrin g() & domain & Chr(34).ToStrin g()
Dim select_query As SelectQuery = New SelectQuery(que ry_command)
query = New ManagementObjec tSearcher(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****@discuss ions.microsoft. comwrote in message
news:B3******** *************** ***********@mic rosoft.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****@discuss ions.microsoft. comwrote in message
news:C7******** *************** ***********@mic rosoft.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 GetUsersInfoCol lection(ByVal domain As String) As
ManagementObjec tCollection
Dim query As ManagementObjec tSearcher
Dim queryCollection As ManagementObjec tCollection
Dim msc As ManagementScope = New ManagementScope ("root\cimv2 ")
Dim query_command As String = "SELECT * FROM Win32_UserAccou nt
WHERE Domain=" & Chr(34).ToStrin g() & domain & Chr(34).ToStrin g()
Dim select_query As SelectQuery = New SelectQuery(que ry_command)
query = New ManagementObjec tSearcher(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****@discuss ions.microsoft. comschreef in bericht
news:C7******** *************** ***********@mic rosoft.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 GetUsersInfoCol lection(ByVal domain As String) As
ManagementObjec tCollection
Dim query As ManagementObjec tSearcher
Dim queryCollection As ManagementObjec tCollection
Dim msc As ManagementScope = New ManagementScope ("root\cimv2 ")
Dim query_command As String = "SELECT * FROM Win32_UserAccou nt
WHERE Domain=" & Chr(34).ToStrin g() & domain & Chr(34).ToStrin g()
Dim select_query As SelectQuery = New SelectQuery(que ry_command)
query = New ManagementObjec tSearcher(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****@discuss ions.microsoft. comschreef in bericht
news:C7******** *************** ***********@mic rosoft.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 GetUsersInfoCol lection(ByVal domain As String) As
ManagementObjec tCollection
Dim query As ManagementObjec tSearcher
Dim queryCollection As ManagementObjec tCollection
Dim msc As ManagementScope = New ManagementScope ("root\cimv2 ")
Dim query_command As String = "SELECT * FROM Win32_UserAccou nt
WHERE Domain=" & Chr(34).ToStrin g() & domain & Chr(34).ToStrin g()
Dim select_query As SelectQuery = New SelectQuery(que ry_command)
query = New ManagementObjec tSearcher(msc, select_query)
queryCollection = query.Get()
Return queryCollection
End Function
--
Dennis in Houston
Sep 23 '07 #7
"Dennis" <De****@discuss ions.microsoft. comwrote in message
news:C7******** *************** ***********@mic rosoft.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 GetUsersInfoCol lection(ByVal domain As String) As
ManagementObjec tCollection
Dim query As ManagementObjec tSearcher
Dim queryCollection As ManagementObjec tCollection
Dim msc As ManagementScope = New ManagementScope ("root\cimv2 ")
Dim query_command As String = "SELECT * FROM Win32_UserAccou nt
WHERE Domain=" & Chr(34).ToStrin g() & domain & Chr(34).ToStrin g()
Dim select_query As SelectQuery = New SelectQuery(que ry_command)
query = New ManagementObjec tSearcher(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****@discuss ions.microsoft. comwrote in message
news:C7******** *************** ***********@mic rosoft.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 GetUsersInfoCol lection(ByVal domain As String) As
ManagementObjec tCollection
Dim query As ManagementObjec tSearcher
Dim queryCollection As ManagementObjec tCollection
Dim msc As ManagementScope = New ManagementScope ("root\cimv2 ")
Dim query_command As String = "SELECT * FROM Win32_UserAccou nt
WHERE Domain=" & Chr(34).ToStrin g() & domain & Chr(34).ToStrin g()
Dim select_query As SelectQuery = New SelectQuery(que ry_command)
query = New ManagementObjec tSearcher(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****@discuss ions.microsoft. comwrote in message
news:05******** *************** ***********@mic rosoft.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
1480
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 the desktop client polls a webservice to return info to the user. The client wants to only manage accounts via the AD. So if they create a new AD user then the app should automatically create a user in the app database. This is not such a problem...
3
16451
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 But I am having a problem figuring out the LDAP:// The LDAP:// that I pass looks like this (i substitued generic the
2
2417
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 logged in, and what network domain they are logged into. And for our environment here (logged into a domain), it seems to work just fine.
5
1405
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, not what I'm looking for. For example, if Sally logs on to the domain as 'sallyJ', then I'd like to be able to pull the logon 'sallyJ' when she clicks a button.
18
23795
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 code/examples? Thanks in advance, Arthur
5
2848
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 conjunction with the free shared SSL certificate offered by my host. To use SSL, you would change a URL like this http://mydomain.com/page.php
0
3204
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 Server. Problem: -------------- I am trying to create an asp.net website with integrated windows authentication to access SQL databases. IIS resides on WinXP and SQL Server on Win2000 SRV. Both are in the same NT Domain. IIS and SQL Server...
0
1162
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 settings for my site, the "Directory Security" tab, the "Edit" button. Then un-check "anonymous access" and check "basic auth" and put in my domain name. Also checking "Integrated Windows Auth" so that the users don't have to type in login credentials. I...
5
13215
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 Properties collection I can't get the properties on some users. For example, I get all the users that are part of my machines Administrators Group. I get get the properties of the built in local Administrator account and some local IT account,...
0
10613
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10363
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10107
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7649
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4327
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3846
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.