Loading |
VBScript |
JavaScript |
Powershell |
Search Options: Search for a SAM Account NameContent of Search for a SAM Account Name.vbsMD5 Hash: D18A9827799BBB21D6F7126E91E1CFBB |
||
' Description: Demonstration script that determines whether the samAccountName kenmyer has already been assigned in Active Directory.
On Error Resume Next Const ADS_SCOPE_SUBTREE = 2 Set objConnection = CreateObject("ADODB.Connection") Set objCommand = CreateObject("ADODB.Command") objConnection.Provider = ("ADsDSOObject") objConnection.Open "Active Directory Provider" objCommand.ActiveConnection = objConnection objCommand.CommandText = "SELECT samAccountName FROM " & _ "'LDAP://dc=fabrikam,dc=com' " & _ "WHERE samAccountName = 'kenmyer'" objCommand.Properties("SearchScope") = ADS_SCOPE_SUBTREE Set objRecordSet = objCommand.Execute If objRecordSet.RecordCount = 0 Then Wscript.Echo "The samAccount name is not being used." Else Wscript.Echo "The samAccount name is being used." End If | ||
© 2008 - 2013 Boris Toll :: Scripts available: 6.481 :: :: scriptbox.toll.at :: :: powered by www.toll.at :: |