I have a script that I use that tells me when and if a user logged on.
The script works fine if I use an input box and only one user it gives me the correct information. However if I run the script reading from a text file, some of the users get an n/a but if I run the same user using the inputbox it gives me the accurate information. This is not isolated to all users, some accounts come out accurate. Please help
Here is the script
Thanks
____________________________________________________________
On Error Resume Next
Dim objFSO,objFile,strLine
Set objFSO = CreateObject("Scripting.FileSystemObject"
Set objFile = objFSO.OpenTextFile("C:\Documents and Settings\me\Desktop\allnames.txt",1)
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
Set myUser = GetObject("WinNT://cort.com" & "/" & strLine & ",user"
If Err <> 0 Then
WScript.Echo strLine & " " & "n/a"
Err.Clear
Else
WScript.echo strLine & " " & myuser.LastLogin
End If
Loop
objFile.close
The script works fine if I use an input box and only one user it gives me the correct information. However if I run the script reading from a text file, some of the users get an n/a but if I run the same user using the inputbox it gives me the accurate information. This is not isolated to all users, some accounts come out accurate. Please help
Here is the script
Thanks
____________________________________________________________
On Error Resume Next
Dim objFSO,objFile,strLine
Set objFSO = CreateObject("Scripting.FileSystemObject"
Set objFile = objFSO.OpenTextFile("C:\Documents and Settings\me\Desktop\allnames.txt",1)
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
Set myUser = GetObject("WinNT://cort.com" & "/" & strLine & ",user"
If Err <> 0 Then
WScript.Echo strLine & " " & "n/a"
Err.Clear
Else
WScript.echo strLine & " " & myuser.LastLogin
End If
Loop
objFile.close