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 \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.
Loading Comments ...
Comments
You must be logged in to make a comment.
mapepo posted this comment on 2024-01-19:
Hi,
I know this post is pretty old but I have a specific question regarding this, so maybe you can still help me with this. We exactly need to prevent a logon script from starting and with your method it works like a charm, but we also need 2 more entries in Winlogon (specific VMWare Helper exe). I tried different methods like adding the exe in the String behind it. Originally after deploying the VM the string looks like this:
C:\Windows\system32\userinit.exe,"C:\Program Files\VMWare\VMWare View\Agent\bin\vmlm_helper.exe","C:\Program Files\VMWare\VMWare View\Agent\bin\wssm.exe",
So I tried to add the value behind it like:
C:\Windows\system32\userinit.exe,"C:\Program Files\VMWare\VMWare View\Agent\bin\vmlm_helper.exe","C:\Program Files\VMWare\VMWare View\Agent\bin\wssm.exe","C:\cmd\DisableLogonScript.cmd",
but that doesn´t work. Can you tell me how I correctly add the DisableLogonScript.cmd to the Key by keeping the other entries?
I look forward to hearing from you
Best Regards
Mark