Nitrous270
Technical User
Okay I was looking at the script in this thread and wondering is there a way to go backwards. If I have a user's full name is there a way to go backwards and retreive their user ID?
Also as an FYI from that thread I tried the following and received an error on line 6, "There is no such object on the server" I don't know if my problems using this script below are going to cause me problems trying to do what I asked above.
Set oNetwork = CreateObject("WScript.Network")
sDomain = oNetwork.UserDomain
sUser = oNetwork.UserName
Set oRootDSE = GetObject("LDAP://RootDSE")
sDomain = oRootDSE.Get("defaultNamingContext")
Set oUser = GetObject("LDAP://CN=" & sUser & ",CN=Users," & sDomain)
WScript.Echo oUser.DisplayName
When I used the following I had no problem.
Set oNetwork = CreateObject("WScript.Network")
sDomain = oNetwork.UserDomain
sUser = oNetwork.UserName
sADSPath= sDomain & "/" & sUser
Set oUser = GetObject("WinNT://" & sADSPath & ",user")
WScript.Echo oUser.FullName
I'm familar with vbs but do not have any experience in Active Directory, but I'm trying to read up on it any help is appreicate thanks.
Also as an FYI from that thread I tried the following and received an error on line 6, "There is no such object on the server" I don't know if my problems using this script below are going to cause me problems trying to do what I asked above.
Set oNetwork = CreateObject("WScript.Network")
sDomain = oNetwork.UserDomain
sUser = oNetwork.UserName
Set oRootDSE = GetObject("LDAP://RootDSE")
sDomain = oRootDSE.Get("defaultNamingContext")
Set oUser = GetObject("LDAP://CN=" & sUser & ",CN=Users," & sDomain)
WScript.Echo oUser.DisplayName
When I used the following I had no problem.
Set oNetwork = CreateObject("WScript.Network")
sDomain = oNetwork.UserDomain
sUser = oNetwork.UserName
sADSPath= sDomain & "/" & sUser
Set oUser = GetObject("WinNT://" & sADSPath & ",user")
WScript.Echo oUser.FullName
I'm familar with vbs but do not have any experience in Active Directory, but I'm trying to read up on it any help is appreicate thanks.