Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript: LDAP Context for Current User

Status
Not open for further replies.

Norris68

IS-IT--Management
Jun 19, 2002
769
GB
I am trying to write a VBS login script for my Windows 2000 Active Directory domain.
How can I find out the LDAP context string for the currently logged in user?

I am using code in the style of
Code:
Set UserObj=GetObject("LDAP://cn=User Name,ou=MyOrg,cn=MyCompany,cn=com")

This is all well and good when I know the 'User Name', but I want to use the current user.

I can get the current user name using
Code:
Set WshNet=CreateObject("WScript.Network")
UserName=WshNet.UserName
however, this will only tell me the login name - not the first & last name as needed by LDAP; or the ou information.

I have looked at the examples on the Microsoft website, but every one seems to use a hard-coded context string.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top