Solved

How do get an attribute  for the current logged on User.

Posted on 2002-06-19
5
157 Views
Last Modified: 2010-05-02
I want to get DistinguishedName attribute for the currentlly logged on user in Windows 2000 Active Directory.

What I really want is to search for the OU that the user is in. I plan to read the DN attribute as a string and then parse it for OU name .

Thanks
0
Comment
Question by:petermoh1
5 Comments
 
LVL 3

Expert Comment

by:Elmo_
ID: 7095359
Peter,

Are you just looking for the Person who is Currently Logged on?


If not could you be more specific.

Cheers,

Ed.
0
 

Author Comment

by:petermoh1
ID: 7097198
Hi ED,

I want to get the DistinguishedName attribute for the user who is currently logged in. The DistinguishedName is an attribute of the User object. This is part of a logon script where I need to map different network mappings depending on what Organisational Unit the user is in. The DistinguishedName i.e. "CN=JBLOGGS,CN=Accounts,DC=Mycompany,DC=COM" tells me which OU the user is in(Accounts).


I know how to get the current username: eg.
Set WshNetwork = WScript.CreateObject("WScript.Network")
WScript.Echo "User Name = " & WshNetwork.UserName


AND I know how to read an attribute for a user object WHEN I MANUALLY SPECIFY THE LDAP PATH: eg.

Set objUser = GetObject _
("LDAP://CN=JBLOGGS,CN=Accounts,DC=Mycompany,DC=COM")
objUser.GetInfo
strAttribute = objUser.Get("<AttributeName>")

BUT I don't know how to do this for the currently logged on user. I kind of need to merge the 2 scripts.

Thanks
0
 

Author Comment

by:petermoh1
ID: 7097239
Hi ED,

I want to get the DistinguishedName attribute for the user who is currently logged in. The DistinguishedName is an attribute of the User object. This is part of a logon script where I need to map different network mappings depending on what Organisational Unit the user is in. The DistinguishedName i.e. "CN=JBLOGGS,CN=Accounts,DC=Mycompany,DC=COM" tells me which OU the user is in(Accounts).


I know how to get the current username: eg.
Set WshNetwork = WScript.CreateObject("WScript.Network")
WScript.Echo "User Name = " & WshNetwork.UserName


AND I know how to read an attribute for a user object WHEN I MANUALLY SPECIFY THE LDAP PATH: eg.

Set objUser = GetObject _
("LDAP://CN=JBLOGGS,CN=Accounts,DC=Mycompany,DC=COM")
objUser.GetInfo
strAttribute = objUser.Get("<AttributeName>")

BUT I don't know how to do this for the currently logged on user. I kind of need to merge the 2 scripts.

Thanks
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7923638
petermoh1, an EE Moderator will handle this for you.
Moderator, my recommended disposition is:

    Refund points and save as a 0-pt PAQ.

DanRollins -- EE database cleanup volunteer
0
 

Accepted Solution

by:
SpideyMod earned 0 total points
ID: 7968393
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question