Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

How to prevent a computer from running a user logon script in Windows Server 2003


View products that this article applies to.

Introduction

This article discusses how to prevent a computer from running a user logon script in Microsoft Windows Server 2003.

User logon scripts contain a set of instructions. These instructions are run when a computer starts. For example, a user logon script may contain instructions about how to map network drives, about how to connect to network printers, or about how to run an antivirus program.

↑ Back to the top


More information

Warning Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall your operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk.

You may experience certain situations where you may want to prevent a computer from running a user logon script. For example, you may want to do this when a terminal server hosts a special environment for a forest.

The user logon script is started from the Userinit.exe process. The Userinit registry value describes the programs that are started by the Winlogon.exe process. The Winlogon.exe process retrieves the Userinit startup parameters from a registry entry inside the following Winlogon registry subkey:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
The parameter that controls the user logon script is set in the UserInitLoginScript variable.

To prevent the system from running the user logon script, the UserInitLoginScript variable must be removed. To do this, follow these steps:
  1. Click Start, point to Programs, point to Accessories, and then click Notepad.
  2. Copy and paste the following code into Notepad:
    @echo off
    		Set UserInitLogonScript=
    		Start %systemroot%\system32\userinit.exe
    		exit
    
  3. Save the text file as a program file by using the .cmd file name extension. For example, save it as DisableLogonScript.cmd.
  4. Click Start, click Run, type regedit, and then click OK.
  5. Locate and then click the following registry subkey:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
  6. In the right pane, double-click Userinit.
  7. In the Value data box, delete the userinit.exe entry, and then type the full path of the file that you created in step 3.
  8. Click OK.
  9. Exit Registry Editor.

↑ Back to the top


References

For more information about how to start a program before the shell at logon, click the following article number to view the article in the Microsoft Knowledge Base:
142905 How to launch a program before the shell at logon

↑ Back to the top


Keywords: KB924034, kbhowto

↑ Back to the top

Article Info
Article ID : 924034
Revision : 6
Created on : 10/11/2007
Published on : 10/11/2007
Exists online : False
Views : 413