Stop logon scripts from treating servers as clients

This tip was submitted to the SearchWin2000 Tip Exchange by member Michael Corkery. Let other users know how useful it is by rating the tip below.

There's a simple way to stop your logon script from making unwanted changes on your NT/2000/XP servers that were designed for your clients (mapping drives and printers, making registry changes, setting policies, etc).

1. Right-click the .bat file stored in the "C:WINNTsystem32ReplExportScripts" folder on your PDC (usually called "logon.bat," but can be any name,) and select "Edit." The file opens in Notepad.

You should include the following three lines as close to the start of the file as possible - ideally just below the first "@echo off" -- before any commands are run or any of the .kix files are called:


  • REM (This breaks servers out of the logon script.)
  • @echo off
  • if exist systemrootlanma256.bmp goto SERVEREND

    Then append to the very end of the file (after the normal exit command for clients) the following:


  • :serverend
  • REM (This exits the LOGON batch file if a server logs in.)
  • @echo This is a Server, aborting logon
  • exit

    How this works is simple -- on Windows NT or higher, all servers have the server graphic "lanma256.bmp" in the systemroot folder (which means that even if it's not

    Requires Free Membership to View

  • installed on the C: partition, it will still work). The clients have the file "winnt256.bmp." Pre-NT Windows clients are OK too, as they do not have the server graphic that is the condition for breaking the script.

    As always, backup the original "logon.bat" file before making any changes, and test the new script before putting it back on the PDC to replicate. Hope this helps!

This was first published in May 2002

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.