Active Directory søg efter bruger
Jeg har fundet dette script hos microsoft, jeg kunne godt tænke mig at i stedet for at skrive at bruger findes skal scripte. skrive brugerens DN (hans sti i Active Directory)ex. CN=Thomas Jensen,OU=Personale,OU=ITafd,DC=Mvk,DC=dk
---------------------------------
CheckForUser("testbruger")
Sub CheckForUser(samAccountName)
strUserName = samAccountName
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=ADsDSOObject;"
Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection
objCommand.CommandText = _
"<LDAP://dc=vordbkom,dc=dk>;(&(objectCategory=User)" & _
"(samAccountName=" & strUserName & "));samAccountName;subtree"
Set objRecordSet = objCommand.Execute
If objRecordset.RecordCount = 0 Then
WScript.Echo "sAMAccountName: " & strUserName & " does not exist."
Else
WScript.Echo strUserName & " exists."
End If
objConnection.Close
End Sub