473,387 Members | 1,455 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,387 software developers and data experts.

How read from Active Directory?

I have no experience with Active Directory and need to programatically read
which user is logged into the domain, the groups they are in, and any other
pertinent information.

Can anyone get me started? I.e. what's the namespace, what does the masic
code look like?

Thanks,
Ron
Jan 12 '07 #1
5 1538

"Ronald S. Cook" <rc***@westinis.comwrote in message
news:eD*************@TK2MSFTNGP04.phx.gbl...
>I have no experience with Active Directory and need to programatically read
which user is logged into the domain, the groups they are in, and any other
pertinent information.

Can anyone get me started? I.e. what's the namespace, what does the masic
code look like?
Look for System.DirectoryServices. Code can be a little strange, partly
because of LDAP.
http://www.ondotnet.com/pub/a/dotnet...activedir.html
I have a good book for it. It might be this one but it doesn't look quite
familiar enough so I'm not sure.
http://www.amazon.com/o/ASIN/1590592...170034-7768849
The thing is I remember buying it on Bookpool but I don't see it on Bookpool
right now, so.... ?
Jan 12 '07 #2
So if our domain is named "ABC", what would the string look like? Something
like:

Dim objRootDSE As New DirectoryEntry(LDAP://ABC)?

How then can I read (from within .NET Win app) name of user logged in and
groups they are a member of?

On my local machine not on a domain, would I see anything?

Thanks,
Ron
"jeffc" <no****@nospam.comwrote in message
news:u2**************@TK2MSFTNGP06.phx.gbl...
>
"Ronald S. Cook" <rc***@westinis.comwrote in message
news:eD*************@TK2MSFTNGP04.phx.gbl...
>>I have no experience with Active Directory and need to programatically
read which user is logged into the domain, the groups they are in, and any
other pertinent information.

Can anyone get me started? I.e. what's the namespace, what does the
masic code look like?

Look for System.DirectoryServices. Code can be a little strange, partly
because of LDAP.
http://www.ondotnet.com/pub/a/dotnet...activedir.html
I have a good book for it. It might be this one but it doesn't look quite
familiar enough so I'm not sure.
http://www.amazon.com/o/ASIN/1590592...170034-7768849
The thing is I remember buying it on Bookpool but I don't see it on
Bookpool right now, so.... ?


Jan 12 '07 #3

"Ronald S. Cook" <rc***@westinis.comwrote in message
news:OJ**************@TK2MSFTNGP03.phx.gbl...
So if our domain is named "ABC", what would the string look like?
Something like:

Dim objRootDSE As New DirectoryEntry(LDAP://ABC)?
It is easiest to use "LDAP://RootDSE" since this is the default root
directory. Beyond that LDAP gets confusing in a hurry and I won't comment
further since I can't remember it very well.
Jan 12 '07 #4
>I have no experience with Active Directory and need to programatically read
>which user is logged into the domain,
Active Directory does not offer that information - it's merely a
repository of STATIC information about users, their group memberships
and so forth, but it does NOT contain any runtime information such as
who is currently logged into a server and so forth.

Marc
Jan 13 '07 #5
"Ronald S. Cook" <rc***@westinis.comwrote in message
news:eD*************@TK2MSFTNGP04.phx.gbl...
>I have no experience with Active Directory and need to programatically read which user is
logged into the domain, the groups they are in, and any other pertinent information.

Can anyone get me started? I.e. what's the namespace, what does the masic code look like?

Thanks,
Ron


As Marc said, you can't get this from the AD. You'll have to use System.Management and get
the current Instances of Win32_LogonSession on the DC. From these instances you will have to
retrieve the associators to find the UserAccount information.
Note that, you will have to connect to and query all DC's in the domain to get all Logins,
note also that this can be extremely time consuming, especially in large domains.

Willy.
Jan 13 '07 #6

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

Similar topics

0
by: microsoft | last post by:
Hi People, when I try to modify an active directory user programatically, I receive the following exception: The server is unwilling to process the request Reading the microsoft web site, I...
9
by: Mario Rodriguez | last post by:
Hi people. I have a problem adding users to Win2003 active directory programatically. When I execute my app throws the following exception: .................The specified directory service...
1
by: Andrew | last post by:
Hey all, Working on revamping our Intranet here and making use of the LDPA, Active Directory, Directory Services, etc. that .Net provides. I am still fairly new on this subject, so the problem...
6
by: Leo_Surf | last post by:
Hello, I need your help adding user in Active Directory from ASP.net website. Could any one provide me the complete code for the html page. As this is my curriculam project and I dont have any...
1
by: tangus via DotNetMonster.com | last post by:
Hello all, I'm really struggling with getting some Active Directory code to work in ASP.NET. Can you please provide assistance? I am executing the following code: Dim enTry As DirectoryEntry =...
10
by: Hriday | last post by:
Hi there, Please help me..It is urgent This is Hriday, working on windows authentication with Active Directory... My requirment is when a user sends a request to my web Applicatoin I want to...
0
by: RTT | last post by:
here is my current situation. I develop a program on my computer's localhost. From there i contact Active directory succesfull using a connectionstring like:...
3
by: Andy | last post by:
HI all, I'm trying to read Active Directory from within an Asp.net application which is not impersonating any domain user. I'd like to allow the site to query the Active directory, but I want...
2
by: Jim in Arizona | last post by:
My goal, somehow, is to populate a dropdownlist with all the user names in active directory. I don't even know where to begin, really. I added a reference to System.DirectoryServices so I could...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
0
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
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
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...

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.