bonecrusher
Well-Known Member
- Joined
- Mar 13, 2007
- Location
- Indian Trail, NC
My needs : A VBS script that takes all LOCAL users and Disables every account over 90 days old.
So far I have a script that creates a txt file and puts all local usernames on it.
I also have a script that will print name and lastlogon but will only do it one username at a time(script below)
I'm still stumped as to how to connect the two.
Here is my code so far
Dim objuser
Dim objUserClass
Dim objProperty
strComputer = "."
Set objUser = GetObject("WinNT://"& strComputer & "/LOCALUSER,user")
Set ObjUserClass = GetObject(objUser.Schema)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("c:\user_status1.txt", 8, True)
ObjTextFile.WriteLine (objUser.Name)
ObjTextFile.WriteLine (objUser.LastLogin)
********************************
It's simple and it works
Only problem is LOCALUSER has to be inputed one at a time.
I have a txt file with all usernames in it seperated by a vbcrlf arguement.
This is driving me nutso.
also as I'm looking at it if the user was created and never logged on it won't return any value and error out.
after I get the script to print out username and lastlogon in a text file then I need to create a vbs script that disables all Local Usernames in that text file.
UGH
So far I have a script that creates a txt file and puts all local usernames on it.
I also have a script that will print name and lastlogon but will only do it one username at a time(script below)
I'm still stumped as to how to connect the two.
Here is my code so far
Dim objuser
Dim objUserClass
Dim objProperty
strComputer = "."
Set objUser = GetObject("WinNT://"& strComputer & "/LOCALUSER,user")
Set ObjUserClass = GetObject(objUser.Schema)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("c:\user_status1.txt", 8, True)
ObjTextFile.WriteLine (objUser.Name)
ObjTextFile.WriteLine (objUser.LastLogin)
********************************
It's simple and it works
Only problem is LOCALUSER has to be inputed one at a time.
I have a txt file with all usernames in it seperated by a vbcrlf arguement.
This is driving me nutso.
also as I'm looking at it if the user was created and never logged on it won't return any value and error out.
after I get the script to print out username and lastlogon in a text file then I need to create a vbs script that disables all Local Usernames in that text file.
UGH