Solved

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

Posted on 2002-06-19
5
154 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_
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

763 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now