Solved

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

Posted on 2002-06-19
5
159 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

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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 Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month6 days, 7 hours left to enroll

636 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