473,320 Members | 1,853 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,320 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 3479
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....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...

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.