Here is a vbscript that will delete comp accts over 60 days old. You can
tweak the 5184000 number to increase or decrease the days. It keeps the age
in minutes. So a computer with a pword age of 86400 is on day old. I
actually schedule this to run once a week so it keeps the list pretty up to
date.
You can omit the " Call oContainer.Delete("Computer",oComputer.name)" line
and it won't delete anything.
P.S. It also logs the activity to a file.
Dim oComputer
Dim oComputerAccount
Dim lngFlags
Dim FSO
Dim oContainer
Dim File
Set FSO = Wscript.CreateObject("Scripting.FileSystemObject")
IF FSO.FileExists("C:\delcomps\delcompaccts60.log") Then
Set File = FSO.OpenTextFile("C:\delcomps\delcompaccts60.log",8)
Else
Set File = FSO.CreateTextFile("C:\delcomps\delcompaccts60.log")
End If
Set oContainer=GetObject("WinNT://yourdomain")
oContainer.Filter=Array("Computer")
For Each oComputer in oContainer
Set oComputerAccount=GetObject(oComputer.AdsPath & "$,user")
If oComputerAccount.Get("PasswordAge")>5184000 Then
lngFlags=oComputerAccount.Get("UserFlags")
If (lngFlags And &H1000) <> 0 Then
FILE.Writeline Date() &" "& Time() &" "&
oComputer.name & " is " & oComputerAccount.Get("PasswordAge")/86400 & " Days
old and was deleted!"
Wscript.Echo oComputer.name & " " &
oComputerAccount.Get("PasswordAge")
Call oContainer.Delete("Computer",oComputer.name)
End If
End If
Next
------
You are subscribed as [email protected]
Archives: http://www.swynk.com/sitesearch/search.asp
To unsubscribe send a blank email to [EMAIL PROTECTED]