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
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
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.
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
I have looked at the examples on the Microsoft website, but every one seems to use a hard-coded context string.