Loading |
VBScript |
JavaScript |
Powershell |
Search Options: Search for a User Account in Active DirectoryContent of Search for a User Account in Active Directory.vbsMD5 Hash: C28160E100B99EC5D4EF3EAF7AC6DD4F |
||
' Description: Searches Active Directory to see if a user account with the name kenmyer already exists.
strUserName = "kenmyer" dtStart = TimeValue(Now()) Set objConnection = CreateObject("ADODB.Connection") objConnection.Open "Provider=ADsDSOObject;" Set objCommand = CreateObject("ADODB.Command") objCommand.ActiveConnection = objConnection objCommand.CommandText = _ " "(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 | ||
© 2008 - 2013 Boris Toll :: Scripts available: 6.481 :: :: scriptbox.toll.at :: :: powered by www.toll.at :: |