Solved

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

Posted on 2002-06-19
5
158 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

734 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