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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

windows 2008 server as terminal srv

Status
Not open for further replies.

Krystian81

Programmer
Sep 10, 2012
11
PL
HI,

I very need script or tip how to write it

script to show who and when was logging into this machine
I know that this is available in security event log but there is millions of entries and I "only" need who and when.

regards
Krystian
 
you can load the security log with vbs and parse the data you need. You can also pick out the relevant entries by specifiying the logon event code: 4648.

Code:
strComputer = "."
set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
set colEvents = objWMI.ExecQuery("Select * from Win32_NTLogEvent Where Logfile = 'Security' and eventcode = '4648'")

for each objEvent in colEvents
    wscript.echo "Computer Name: " & objEvent.ComputerName & vbNewLine _
               & "Event Message: " & objEvent.Message & vbNewLine _
               & "Audit Time: " & objEvent.TimeWritten & vbNewLine
next

-Geates

"I do not offer answers, only considerations."
- Geates's Disclaimer

 
You might also want to try the relevant Server forum, such as forum1674. For example, you could create a logon (and also a logoff) script that logs the user and date/time, etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top