Solved

Who logged into the windows 2003 server and when.

Posted on 2009-04-02
4
488 Views
Last Modified: 2013-12-05
I need a tool or preferably a vb script that will report to me who logged into a windows 2003 server, when and from which IP address. I want to run this script against five servers once a day and get a report of who has logged into the servers from RDP & console within the past 24 hours. I have full domain admin access but no clue how to achieve this.

Is this possible? i see a bunch of stuff in the event viewer but deciphering it is a nightmare. There must be a better way!?!?
0
Comment
Question by:MoogControls
  • 2
4 Comments
 
LVL 3

Expert Comment

by:maniksaha
ID: 24048364
Please follow the steps to achieve your GOAL.

This is a great little batch file that enables an admin to keep a log of where, when and what computer user log on to and when they log off.
1.       Set up a Share on the network.
The batch file is actually two files. One runs at user log on and one runs at useer log off. When the batch files run, they create a rolling log file with the details in a shared network folder.
1) Create a shared folder on the network. Mine is called Logs. Everyone should have full access to this share.
2) In that folder, create a folder called User and a folder called computer.       
2.       Create the batch files.
Copy and Paste the following into two separate text files. When you save them, remember to change the file type to .bat
Name: Log On.bat
rem The following line creates a rolling log file of usage by workstation
echo Log In %Date% %TIME% %USERNAME% >> \\servername\Logs\Computer\%COMPUTERNAME%.log
rem The following line creates a rolling log file of usage by user
echo Log In %Date% %TIME% %COMPUTERNAME% >> \\servername\Logs\User\%USERNAME%.log
Name: Log Off.bat
rem The following line creates a rolling log file of usage by workstation
echo Log Off %Date% %TIME% %USERNAME% >> \\servername\Logs\Computer\%COMPUTERNAME%.log
rem The following line creates a rolling log file of usage by user
echo Log Off %Date% %TIME% %COMPUTERNAME% >> \\servername\Logs\User\%USERNAME%.log
Put these files in the Logs folder.      
3.       Add the batch files to group policy.
You do this on your User Container GPO.
User Configuration > Windows Settings > Scripts
Add Log In.bat to the Logon scripts box and Log Off.bat to the Logoff scripts box      


Ref: http://community.spiceworks.com/how_to/show/82

Hope it will help u, plz check and revert
0
 

Author Comment

by:MoogControls
ID: 24048434
Thanks maniksaha, I was hoping to achieve my goal using the data from the event viewer. As it is the enterprise admins, and domain admins from other domains that i am trying to track. Because it is another domain i cannot edit their domain GPO. Any ideas?
0
 
LVL 8

Expert Comment

by:JustWorking
ID: 24055423
MooqControls,

I understand you are looking to extract this data from the Even Viewer howerver here is something I have used. It is vbscript that will write a text file (same locatoin as the vbs) with user, computer and run time. I placed this in my server start up menus so it runs at every login and appends to the file. The logged text file will look like this:

Current Date: ,Thursday, April 02, 2009 @ 6:51:40 PM
Current User: ,DomainName\username
Computer Name: ,Servername

Then I would check the text file once a day to view the logins and keep the text file for reference.

JW
Set oNet = CreateObject("WScript.Network")
Set oFS = CreateObject("Scripting.FileSystemObject")
Set oWS = CreateObject("Wscript.Shell")
 
sCurrentUser = oNet.UserName
sDomain = oNet.UserDomain
sComputer = oNet.ComputerName
 
sScriptName = WScript.ScriptName
sScriptPath = WScript.ScriptFullName
sLog = Replace(sScriptName, ".vbs", ".log")
sLogFile = Replace(sScriptPath, sScriptName, sLog)
 
Set oLogFile = oFS.OpenTextFile(sLogFile, 8, True)
 
 
Function CurrentDateTime()
	CurrentDateTime = FormatDateTime(now, vbLongDate) & " @ " & FormatDateTime(now, vbLongTime)
End Function
 
	oLogFile.WriteLine "Current Date: " & "," & CurrentDateTime
	oLogFile.WriteLine "Current User: " & "," & sDomain & "\" & sCurrentUser
	oLogFile.WriteLine "Computer Name: " & "," & sComputer
	oLogFile.WriteLine VbCrLf

Open in new window

0
 

Accepted Solution

by:
MoogControls earned 0 total points
ID: 24107581
Thank you both for your suggestions.

We have decided to purchase a product from GFI called Event Manager. It is a bit expensive approx £170 per monitored server but it looks like it make good sense of all messages the event log.
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Connecting two servers 30 87
Downgrade From Domain to WorkGroup 3 61
How to install a font on WIN2003SBS/IIS 6 & test 17 33
Raising Forest Functional Level 9 37
Issue: One Windows 2008 R2 64bit server on the network unable to connect to a buffalo Device (Linkstation) with firmware version 1.56. There are a total of four servers on the network this being one of them. Troubleshooting Steps: Connect via h…
Know what services you can and cannot, should and should not combine on your server.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question