473,405 Members | 2,167 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,405 software developers and data experts.

windows users

Jim
Hi

I would like to get all the windows users defined in the current domain.
What is the code for this?

ch Jim
Nov 16 '05 #1
10 3483
Using WMI - "Select * from Win32_UserAccount" and then look for "FullName"
or "Name" where "Domain" matches.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
"Jim" <pe*********@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi

I would like to get all the windows users defined in the current domain.
What is the code for this?

ch Jim

Nov 16 '05 #2
Jim
against which database do i have to run this?

ch Jim
"Sahil Malik" <co*****************@nospam.com> schreef in bericht
news:uB**************@TK2MSFTNGP15.phx.gbl...
Using WMI - "Select * from Win32_UserAccount" and then look for "FullName"
or "Name" where "Domain" matches.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
"Jim" <pe*********@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi

I would like to get all the windows users defined in the current domain.
What is the code for this?

ch Jim


Nov 16 '05 #3
You should not use WMI for this, use the System.Directory namespace classes
DirectoryEntry and DirectorySearcher, these are wrappers arround ADSI.
If your domain is AD based (W2K and higer) use the LDAP ADSI provider for
downlevel domains (NT4) you have to use WinNT as provider.
Check following link for samples:

http://msdn.microsoft.com/library/de...e_examples.asp

Willy.
"Jim" <pe*********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
against which database do i have to run this?

ch Jim
"Sahil Malik" <co*****************@nospam.com> schreef in bericht
news:uB**************@TK2MSFTNGP15.phx.gbl...
Using WMI - "Select * from Win32_UserAccount" and then look for
"FullName" or "Name" where "Domain" matches.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
"Jim" <pe*********@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi

I would like to get all the windows users defined in the current domain.
What is the code for this?

ch Jim



Nov 16 '05 #4
Please set your system clock correctly.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Jim" <pe*********@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi

I would like to get all the windows users defined in the current domain.
What is the code for this?

ch Jim

Nov 16 '05 #5
Jim
what is the problem with it? it displays the correct time over here

Jim
"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:Ok**************@TK2MSFTNGP12.phx.gbl...
Please set your system clock correctly.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Jim" <pe*********@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi

I would like to get all the windows users defined in the current domain.
What is the code for this?

ch Jim


Nov 16 '05 #6
Jim
thanks!

ch Jim
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:Ot**************@TK2MSFTNGP14.phx.gbl...
You should not use WMI for this, use the System.Directory namespace classes DirectoryEntry and DirectorySearcher, these are wrappers arround ADSI.
If your domain is AD based (W2K and higer) use the LDAP ADSI provider for
downlevel domains (NT4) you have to use WinNT as provider.
Check following link for samples:

http://msdn.microsoft.com/library/de...e_examples.asp
Willy.
"Jim" <pe*********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
against which database do i have to run this?

ch Jim
"Sahil Malik" <co*****************@nospam.com> schreef in bericht
news:uB**************@TK2MSFTNGP15.phx.gbl...
Using WMI - "Select * from Win32_UserAccount" and then look for
"FullName" or "Name" where "Domain" matches.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
"Jim" <pe*********@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi

I would like to get all the windows users defined in the current domain. What is the code for this?

ch Jim



Nov 16 '05 #7
Jim,

It can be as well that your localization setting of your computer is wrong.

Cor
Nov 16 '05 #8
Isn't WMI an alternative? Why shouldn't it be used?

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik

"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:Ot**************@TK2MSFTNGP14.phx.gbl...
You should not use WMI for this, use the System.Directory namespace classes DirectoryEntry and DirectorySearcher, these are wrappers arround ADSI.
If your domain is AD based (W2K and higer) use the LDAP ADSI provider for
downlevel domains (NT4) you have to use WinNT as provider.
Check following link for samples:

http://msdn.microsoft.com/library/de...e_examples.asp
Willy.
"Jim" <pe*********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
against which database do i have to run this?

ch Jim
"Sahil Malik" <co*****************@nospam.com> schreef in bericht
news:uB**************@TK2MSFTNGP15.phx.gbl...
Using WMI - "Select * from Win32_UserAccount" and then look for
"FullName" or "Name" where "Domain" matches.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
"Jim" <pe*********@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi

I would like to get all the windows users defined in the current domain. What is the code for this?

ch Jim



Nov 16 '05 #9

"Sahil Malik" <co*****************@nospam.com> wrote in message
news:uk**************@TK2MSFTNGP12.phx.gbl...
Isn't WMI an alternative? Why shouldn't it be used?

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik

Following are a number of reasons not to use WMI for this:
1. Speed. WMI wasn't designed for domain account management tasks,
especially for larger domains it tends to be real slow, Win32_UserAccount is
particularly known to affect performance negatively. LDAP based DS where
specially designed to execute such queries real fast.
2. Security. Most domain admins turn off WMI services on DC's, or are
granting access to domain admin only.
3. WMI doesn't have a notion of an AD domain hierarchy and as such is not as
feature rich as AD based DS.
4. Using WMI you have to know the DC to connect to, so it fails if the DC is
not reachable, AD DS automatically finds an alternate DC in the domain if a
connection to the logon DC fails.
5. WMI fails to enumerate other domains in the forest (see 3).

One can say it's an alternative for very small NT4 domains, but as it
doesn't offers any advantage over using the ADSI based "WinNT" provider
interfaces encapsulated by System.DirectoryServices, I would say stick with
DS even for small NT4 domains.

Willy.

Nov 16 '05 #10
Thanks Willy, these newsgroups are ultra-awesome.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik

"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:#s**************@TK2MSFTNGP15.phx.gbl...

"Sahil Malik" <co*****************@nospam.com> wrote in message
news:uk**************@TK2MSFTNGP12.phx.gbl...
Isn't WMI an alternative? Why shouldn't it be used?

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
Following are a number of reasons not to use WMI for this:
1. Speed. WMI wasn't designed for domain account management tasks,
especially for larger domains it tends to be real slow, Win32_UserAccount

is particularly known to affect performance negatively. LDAP based DS where
specially designed to execute such queries real fast.
2. Security. Most domain admins turn off WMI services on DC's, or are
granting access to domain admin only.
3. WMI doesn't have a notion of an AD domain hierarchy and as such is not as feature rich as AD based DS.
4. Using WMI you have to know the DC to connect to, so it fails if the DC is not reachable, AD DS automatically finds an alternate DC in the domain if a connection to the logon DC fails.
5. WMI fails to enumerate other domains in the forest (see 3).

One can say it's an alternative for very small NT4 domains, but as it
doesn't offers any advantage over using the ADSI based "WinNT" provider
interfaces encapsulated by System.DirectoryServices, I would say stick with DS even for small NT4 domains.

Willy.


Nov 16 '05 #11

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

Similar topics

16
by: Robert Mark Bram | last post by:
Hi All! Is there a way to reference a window by name without doing something like this: open (, 'windowName'); The open method will open a blank window if there is no window with such a name....
3
by: Nick | last post by:
I am working a new application...well actually a series of applications for my company. They want internal users to be able to go to a site and everything regarding security is transparent,...
1
by: Sean | last post by:
Hi. I'm converting a project which uses windows form UI to Windows service. I just finished converting but I can't use any UI (winform or console). can't Windows Service use UI? then what...
4
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
0
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
3
by: Chris Paul | last post by:
I'm having trouble with PHP & PostgreSQL/OpenLDAP/Apache on Windows. I've set this up countless times on BSD (piece of cake) but I'm trying to do this on Windows now so that my developer can work...
0
by: genzy | last post by:
I'm facing the below problem. With <deny users="?" />, the Windows Login ID is able to be obtained to fill up the Windows IDSID text field automatically, but reading the file info is failed. ...
7
by: torus | last post by:
Is the aspnet account called "aspnet" for all non-English versions of Windows and IIS?
30
by: diane | last post by:
I've got an application running with table-based security: i capture the user's windows login with fOsusername, then have them enter a password checked against their username/login in my own table....
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...
0
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...

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.