your welcome.

-----Original Message-----
From: Sveinung Eikenes [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 27, 2001 3:50 AM
To: NT 2000 Discussions
Subject: RE: Program that lists last time a computer account was logged
in


Thank you!. It worked! 

Andrew Baker: USRSTAT only list user accounts, not computer accounts.

-----Original Message-----
From: Evans Chris - cevans [mailto:[EMAIL PROTECTED]] 
Sent: 24. august 2001 20:08
To: NT 2000 Discussions
Subject: Program that lists last time a computer account was logged in

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]

------
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