This may help. This is a script I use to automatically delete computer
account over 60 days old that have not renewed their pword. Might get you
started.

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


-----Original Message-----
From: Paul Markette [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, October 16, 2001 1:09 PM
To: NT 2000 Discussions
Subject: Scavenging AD Objects

Hello All,
        I'm looking for a way to scavenge old objects from AD.  Basically, I
want to be able to remove user and computer objects which have not been used
for a certain period of time.  Using a NetIQ script, I am able to generate a
report showing when each user account last interactively logged into the
domain, but I can find no way to determine which computer objects are in
use.  
        Does anyone have any scripts (ADSI VBS would be really cool!),
utilities or ideas that would help with my cleanup?

Thanks!

Paul Markette
NT Systems Administrator
Epicentric, Inc.
[EMAIL PROTECTED]
415-995-7228


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