Q. How can I prevent a user logon script from running on a specific Windows Server 2003 computer?

If you want to prevent a user logon script from running on a specific Windows Server 2003 computer, like a Terminal Server, you can prevent the Userinit.exe process from running it, by altering the Userinit Value Name at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon and by setting the UserInitLoginScript variable to nul:

1. Save the following to a <Drive:>\FolderName\DisableLogonScript.cmd file:

@echo off
Set UserInitLogonScript=
Start %systemroot%\system32\userinit.exe
exit
2. Open a CMD.EXE window.

3. Type the following command and press Enter:

REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /V Userinit /T REG_SZ /F /D "<Drive:>\FolderName\DisableLogonScript.cmd"
NOTE: <Drive:>\FolderName\ is the drive letter and folder path where you saved the DisableLogonScript.cmd file.


Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish