Tracking User Logins with Login/Logoff Scripts

Hi ;
Even though we can use event viewer for this; there is a nice way to keep a track of the Remote Desktop Logins using a little script;

In order to do so :

1. Log in to your server & Write the following bat script on :

c:\Reporting\logon.bat( Create folder & file )

c:\Reporting\Logoff.bat

with the following code:

Login Code
Echo %date%,%time%,%username%,%computername% >> C:\Reporting\Logons.txt

Logoff Code

Echo LOGOFF,%date%,%time%,%username%,%computername% >> "C:\Reporting\%username%.log

As you can see this would be the output;

2018-11-22 13_38_13-Window.png

2.Use Local Group Policy to run the scripts ( OR Group Policy )

2018-11-22 13_42_11-Window.png

3.Copy your Scripts on

C:\Windows\System32\grouppolicy\user\scripts\logon.

4. Reboot the server and check the files if are working;

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s