Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Old computer accounts

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,3575
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Old computer accounts
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Old computer accounts - 6/29/2005 8:49:41 AM   
  durhamrobertl

 

Posts: 1
Score: 0
Joined: 6/29/2005
From:
Status: offline
This .vbs was working, then quit . I'm not sure how long ago it quit working, but the only thing I know has changed is SP's and going native. I wrote this for the server group to keep the old computer accounts cleaned up, so not sure if it was modified slightly and I'm not seeing it, or if being native now is the problem with the connection. I get an error on the Set Computer line for "The network path was not found". I can only guess that it no longer likes the netbios name for the domain we usually input, but WINS is still running and the entries are there. Originally, (prior to being native) I had trouble getting connected via RootDSE, so did this instead. Any help would be appreciated...

Dim Container
Dim Member
Dim Computer
Dim AgeInDays
Dim AgeInSeconds
dim strDomName
dim strFileName

Counter = 0

strMsgDom="Please enter the Domain you wish to view: "
strDomName=Inputbox(strMsgDom,"Enter Domain Name")
strMsgFile="Please modify the location and the text file name that you want: "
strFilename=Inputbox(strMsgFile,"Folder and File Name","C:\Temp\OldMacAc.txt")

set fso=CreateObject("Scripting.FileSystemObject")
set fil=fso.CreateTextFile(strFileName)
fil.WriteLine strDomName & " Old Machine Accounts and number of days since last used"
fil.WriteLine ""

Set Container = GetObject("WinNT://" & strDomName)
Container.Filter = Array("Computer")
For Each Member In Container
Set Computer = GetObject("WinNT://" & strDomName & "/" & "Computer.Name" & ",computer")
AgeInSeconds = Computer.Get("PasswordAge")
AgeInDays = Cint(((AgeInSeconds/60)/60)/24)
If AgeInSeconds > 15552000 Then
fil.WriteLine(Computer.Name & " " & AgeInDays)
Counter = Counter + 1
End If
Next

Wscript.Echo Counter & " machine accounts are old"

set fop=CreateObject("WScript.Shell")
fop.run "%windir%\Notepad.exe C:\Temp\OldMacAc.txt"
 
 
Post #: 1
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Old computer accounts Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts