Login Scripts
Recording Script Results

It is often useful to see whether a login script has run correctly. Not only is this useful for troubleshooting while testing a new script, once the script is live it allows you or other IT personnel to verify that the script ran correctly.

Create a login script batch file (for example called login2.bat) with the following line
(presuming your main login script is called "login.bat")

What this does is call your main login script so that it runs as normal. However it also uses the "systemdrive" variable from Windows (usually C:\) to find a path and and then creates a txt file with the results of the login script. A new file is created each time.

In User Manager you enter the name of the login script with this single line ("login2.bat") and not your main script. Copy both scripts to the Netlogon share.

You can also append the date and time to the results file. Change the "login2.bat" file to something like this:

If you want to record a complete log of all logins (rather than replacing the file each time) on the local machine, then change the first line of the above script to

The file will never be overwritten, just new text appended to it.

Using this method also has the advantage that if you have to change the name of your machine login script for any reason, you only need to change it in one place - and not have to change the properties of every user.

If you are using this in a Citrix or Terminal Server environment, or a machine that has multiple users then you should change the path the login script information is logged to. Otherwise you will not be able to diagnose who was writing to the script when using it as a troubleshooting tool. The most convenient location will be "%userprofile%", making the script look like this instead:


Top of the Page - Home Page
Last Page Update: 28/03/2015

Copyright Sembee Ltd. 1998 - 2024.

Reproduction of any content on this web site is prohibited without express written consent. Use of this web site is subject to our terms and conditions.

All trademarks and registered trademarks are property of their respective owners. This site is not endorsed or recommended by any company or organisation mentioned within and is to provide guidance only and as such we cannot be held responsible for any consequences of following the advice given.

Sembee Ltd. is registered in England and Wales at 1 Carnegie Road, Newbury, Berkshire, RG14 5DJ.
Registered company number: 4704428. VAT Number GB 904 5603 43.

Server 1