![]() |
|
|||||||
| Petri.co.il is happy to award Virtual the title of Most Valuable Member !!! |
| Register | Calendar |
Search |
Today's Posts | Mark Forums Read |
| Notices |
|
Logon Event ID and Reportthis thread has 3 replies and has been viewed 1409 times
|
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||||||
|
||||||||
|
Hi,
I need to make a report about some users and the time they logged on against a Win2003 Server. I was using the event viewer and while trying to filter some information, i'm not quite sure what Event ID to use regarding the Logon. Anybody knows what event id is used when a user logs in in a windows server? Any tool that can easily generate reports like these? Thank you very much! |
|
#2
|
|||||||||||
|
|||||||||||
|
The Event ID I believe youre looking for is 528 (successful logon) and 540 (successful network logon).
You could use a visual basic script to list all Event Codes in the Security Log, you just need to change the Event Code as appropriate. Just copy the below into a text file and save as a .vbs file extension. Code:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colLoggedEvents = objWMIService.ExecQuery _
("Select * from Win32_NTLogEvent Where Logfile = 'Security' and " _
& "EventCode = '540'")
For Each objEvent in colLoggedEvents
strTimeWritten = objEvent.TimeWritten
dtmTimeWritten = CDate(Mid(strTimeWritten, 5, 2) & "/" & _
Mid(strTimeWritten, 7, 2) & "/" & Left(strTimeWritten, 4) _
& " " & Mid (strTimeWritten, 9, 2) & ":" & _
Mid(strTimeWritten, 11, 2) & ":" & Mid(strTimeWritten, 13, 2))
dtmDate = FormatDateTime(dtmTimeWritten, vbShortDate)
dtmTime = FormatDateTime(dtmTimeWritten, vbLongTime)
Wscript.Echo "Username: " & objEvent.User
WScript.Echo "Date: " & dtmDate
WScript.Echo "Time: " & dtmTime
Next
Code:
cscript filename.vbs
__________________
MCSA 2000/2003 |
|
#3
|
||||||||||
|
||||||||||
|
very nice, but you can also create a filtered view in the event viewer itself.
__________________
"...if I turn out to be particularly clear, you've probably misunderstood what I've said” - Alan Greenspan |
|
#4
|
||||||||
|
||||||||
|
Yep, works great!!! Thanks a lot
|
![]() |
|
||||||
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| mail report details | peter_lev | SBS 2000/2003 | 0 | 8th May 2007 10:45 |
| event ID 1016: perflib and event ID 63: Winmgmt in sbs 2003 | rsin | SBS 2000/2003 | 5 | 19th March 2007 20:26 |
| Create A Report | COSY | General Scripting | 3 | 31st January 2007 10:10 |
| please help i need to get on my computer to print a report | beaglelover101 | Forgot Administrator Password | 1 | 28th July 2005 09:39 |
| Login and Logoff report | asam71 | General Scripting | 4 | 30th June 2005 01:15 |