rushtosri
2009-03-19 12:03:51 UTC
Hi Guys,
I'm working on a script to enumerate OUs for disabled computer
objects. Any idea how the query should look like? The following script
can lookup for disabled user accounts. Any thoughts on how to modify
this script to lookup for disabled computer accounts??
Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection
objCommand.CommandText = _
"<GC://dc=fabrikam,dc=com>;(objectCategory=User)" & _
";userAccountControl,distinguishedName;subtree"
Set objRecordSet = objCommand.Execute
intCounter = 0
Do Until objRecordset.EOF
intUAC=objRecordset.Fields("userAccountControl")
If intUAC AND ADS_UF_ACCOUNTDISABLE Then
WScript.echo objRecordset.Fields("distinguishedName") & " is
disabled"
intCounter = intCounter + 1
End If
objRecordset.MoveNext
Loop
Thanks in advance.
I'm working on a script to enumerate OUs for disabled computer
objects. Any idea how the query should look like? The following script
can lookup for disabled user accounts. Any thoughts on how to modify
this script to lookup for disabled computer accounts??
Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection
objCommand.CommandText = _
"<GC://dc=fabrikam,dc=com>;(objectCategory=User)" & _
";userAccountControl,distinguishedName;subtree"
Set objRecordSet = objCommand.Execute
intCounter = 0
Do Until objRecordset.EOF
intUAC=objRecordset.Fields("userAccountControl")
If intUAC AND ADS_UF_ACCOUNTDISABLE Then
WScript.echo objRecordset.Fields("distinguishedName") & " is
disabled"
intCounter = intCounter + 1
End If
objRecordset.MoveNext
Loop
Thanks in advance.