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

By | 2006-09-25

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 null:

1. Save the following to a \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 "\FolderName\DisableLogonScript.cmd"

NOTE: \FolderName\ is the drive letter and folder path where you saved the DisableLogonScript.cmd file.

Author: dwirch

Derek Wirch is a seasoned IT professional with an impressive career dating back to 1986. He brings a wealth of knowledge and hands-on experience that is invaluable to those embarking on their journey in the tech industry.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.