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://conway")

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


-----Original Message-----
From: Joe Pochedley [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 24, 2001 9:21 AM
To: NT 2000 Discussions
Subject: RE: program that lists last time a computer account was logged
in


Check out MSKB article Q197478

-----Original Message-----
From: Andrew Baker [mailto:[EMAIL PROTECTED]] 
Sent: Friday, August 24, 2001 10:15 AM
To: NT 2000 Discussions
Subject: RE: program that lists last time a computer account was logged in


USRSTAT (ResKit)

 
- ASB
 


-----Original Message-----
From: Sveinung Eikenes [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 24, 2001 3:43 AM
To: NT 2000 Discussions
Subject: program that lists last time a computer account was logged in


Hi
 
Have anyone seen a utility that can list when computer accounts in a domain
last logged in? We want to seek out old computer accounts and we dont like
to use the ping method. The utility should be usable to batch jobs.
 
Thank you.


------
You are subscribed as [EMAIL PROTECTED]
Archives: http://www.swynk.com/sitesearch/search.asp
To unsubscribe send a blank email to [EMAIL PROTECTED]

------
You are subscribed as [EMAIL PROTECTED]
Archives: http://www.swynk.com/sitesearch/search.asp
To unsubscribe send a blank email to [EMAIL PROTECTED]

------
You are subscribed as [email protected]
Archives: http://www.swynk.com/sitesearch/search.asp
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to