|
-
Apr 4th, 2003, 12:00 PM
#1
Thread Starter
Fanatic Member
ADSI - User Context
Does anyone know how to use VBSCript (maybe using ADSI or LDAP) to get the context that the current logged in user is in? In other words, I know how to get the logged in users username, but I need to know where that username resides in Active Directory.
Thanks
-
Apr 4th, 2003, 05:01 PM
#2
Thread Starter
Fanatic Member
-
Apr 4th, 2003, 05:42 PM
#3
Thread Starter
Fanatic Member
Resolved!!
Syntax:
Dim nto
const ADS_NAME_INITTYPE_SERVER = 2
const ADS_NAME_INITTYPE_DOMAIN = 1
const ADS_NAME_TYPE_1779 = 1
const ADS_NAME_TYPE_NT4 = 3
Set objNetwork = CreateObject("WScript.Network")
Do While strUser = ""
strUser = objNetwork.UserName
WScript.Sleep 100
Loop
dn = "DSHS\" & strUser
Set nto = CreateObject("NameTranslate")
nto.Init ADS_NAME_INITTYPE_DOMAIN, "YourDomain"
nto.Set ADS_NAME_TYPE_NT4, dn
result_ldap = nto.Get(ADS_NAME_TYPE_1779)
WScript.Echo "Translated name: " & result_ldap
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|