Chris, 
        Thank you so much for your script!  I am having problems running the
script though, as I think there was some undesirable wrapping in the email.
So I have 2 requests for you.

1)      Would you mind please sending me this script as an attachment?
2)      Do you have any good resources for ADSI scripting, such as how to
websites or script repositories?  I'd really love to learn how to directly
manipulate the objects in my directory.

Thank you so much for your help,

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


-----Original Message-----
From: Evans Chris - cevans [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 16, 2001 11:20 AM
To: NT 2000 Discussions
Subject: RE: Scavenging AD Objects


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]

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