473,503 Members | 12,136 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3488
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
34535
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
2690
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
2587
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
3497
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
3021
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
7470
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
1375
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
1902
by: torus | last post by:
Is the aspnet account called "aspnet" for all non-English versions of Windows and IIS?
30
6930
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....
0
7212
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7296
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,...
1
7017
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
7470
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
5604
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,...
1
5026
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...
0
4696
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
751
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
405
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...

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.