G
Guest
Hi
I have checked out all the script examples on Microsofts TechNet site, but I don't find what I'm looking for
I want to read out from W2K-server Active Directory different kind of information based upon the sAMAccountName
I manage to read out the information but only based upon the "cn".
As long as I set strName = "jack russel" I get the information. But if I change to strName = "jackr" It says "No such object!
jackr is the sAMAccountName!
I also want to skip the strContainer - because the users could be anywhere in the AD
Can anyone help me please
Here is the sample script
strContainer = "ou=IT,ou=L,ou=NatverkA,ou=Org
strName = "jack russel
' Connect to an objec
Set objRootDSE = GetObject("LDAP://rootDSE"
If strContainer = "" The
Set objItem = GetObject("LDAP://" &
objRootDSE.Get("defaultNamingContext")
Els
Set objItem = GetObject("LDAP://cn=" & strName & "," & strContainer & "," &
objRootDSE.Get("defaultNamingContext")
End I
WScript.Echo "Sökt namn: " & strNam
'strSamName = objItem.Get("sAMAccountName"
'WScript.Echo "Kortnamn från AD: " & strSamNam
'strname = objItem.Get("sAMAccountName"
'WScript.Echo "Kortnamn från AD: " & strnam
strComonName = objItem.Get("cn"
WScript.Echo "cn: " & strComonNam
strmail = objItem.Get("mail"
WScript.Echo "mail: " & strmail
I have checked out all the script examples on Microsofts TechNet site, but I don't find what I'm looking for
I want to read out from W2K-server Active Directory different kind of information based upon the sAMAccountName
I manage to read out the information but only based upon the "cn".
As long as I set strName = "jack russel" I get the information. But if I change to strName = "jackr" It says "No such object!
jackr is the sAMAccountName!
I also want to skip the strContainer - because the users could be anywhere in the AD
Can anyone help me please
Here is the sample script
strContainer = "ou=IT,ou=L,ou=NatverkA,ou=Org
strName = "jack russel
' Connect to an objec
Set objRootDSE = GetObject("LDAP://rootDSE"
If strContainer = "" The
Set objItem = GetObject("LDAP://" &
objRootDSE.Get("defaultNamingContext")
Els
Set objItem = GetObject("LDAP://cn=" & strName & "," & strContainer & "," &
objRootDSE.Get("defaultNamingContext")
End I
WScript.Echo "Sökt namn: " & strNam
'strSamName = objItem.Get("sAMAccountName"
'WScript.Echo "Kortnamn från AD: " & strSamNam
'strname = objItem.Get("sAMAccountName"
'WScript.Echo "Kortnamn från AD: " & strnam
strComonName = objItem.Get("cn"
WScript.Echo "cn: " & strComonNam
strmail = objItem.Get("mail"
WScript.Echo "mail: " & strmail