|
Bulk unlock user accounts We have been hit by the W32.Downadup.B virus. While we are removing it from
our network, our users are bing locked out. I patched together the
following script from some sample on the Microsoft site. It is not working.
Any suggestions as to what is wrong and how to get it to work?
*********
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"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = _
"SELECT * FROM 'LDAP://dc=fabrikam,dc=com' WHERE objectCategory='user'"
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Set objUser = GetObject ("LDAP://cn=" & objRecordSet.Fields("Name").Value &
",dc=NA,dc=fabrikam,dc=com")
objUser.IsAccountLocked = False
objUser.SetInfo
objRecordSet.MoveNext
Loop
********* |