Follow these steps
- Create the folder LNScript somewhere on your server
- Create a Sub Folder called logs
- Give RF rights to LNScript and RW to logs
- Create a file named silentrunner.vbs in the LNScript folder
- Copy this code to the file
Set WshShell = CreateObject("WScript.Shell")
WshShell.run chr(34) & "F:\LNScript\track.bat" & Chr(34), 0
Set WshShell = Nothing
The above code allows batch files to run silently, users will never see this batch file run. This code can be used for any other batch files you would like to run.
- Create track.bat in the LNScript folder
- Copy code below into track.bat
for /f "delims=[] tokens=2" %%a in ('ping %computername% -4 -n 1 ^| findstr "["') do (set thisip=%%a)
echo Login Date: %Date%, Login Time: %Time%, Computer Name: %ComputerName%, User Name: %USER%, IP: %thisip%>>f:\LNScript\logs\login.csv
This will create a csv file that has the login time & date, computer name, novell user name, & IP.
Next we need to add this code to the login script (This creates a dos variable for the novell username that we can use in the batch file)
DOS SET USER="%1"
@wscript.exe F:\LNScript\silentrunner.vbs
You can either periodically clear out the log file manually or setup a scheduled task that renames the log file. The next time someone logs in the log file will be recreated. You don't want the log to get too big as that will cause other problems. Below is a picture of the log file output,
No comments:
Post a Comment