Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter text file from psloggedon output

Status
Not open for further replies.

krammer

IS-IT--Management
Jul 15, 2007
59
US
I'v made a script that creates a text file using psloggedon. The output looks similar to this:

Code:
Users logged on via resource shares:
     11/21/2007 12:57:34 PM    DOMAIN\user
Connecting to Registry of \\PC...
                                                                              
Users logged on locally:
     Error: could not retrieve logon time
NT AUTHORITY\LOCAL SERVICE
     Error: could not retrieve logon time
NT AUTHORITY\NETWORK SERVICE
     10/26/2007 10:57:07 AM    DOMAIN\user
     Error: could not retrieve logon time
NT AUTHORITY\SYSTEM

Does anyone know how to filter this, or cut it down to only look like this:

Code:
PCNAME
NT AUTHORITY\NETWORK SERVICE
     10/26/2007 10:57:07 AM    DOMAIN\user
     Error: could not retrieve logon time

I was thinking it would be somewhat similar to what I've have been shown here before...this is just and example I know its not right...

Code:
PSLOG = WshShell.Run("%comspec% /c ""C:\psloggedon.exe"" \\" & strComputer & " >>C:\Results.txt", 0, True)
PSLOG = Left(PSLOG , Len(PSLOG) - 17)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top