How to Disable Windows Script Host to Stop Script-Based Malware
Disabling WSH can block VBS and JS malware on systems that do not need it, and Kudu can help review safe hardening steps.
By the Kudu Team
Fix this automatically with Kudu
Run a free system scan to detect and resolve this issue automatically — no manual steps required.
Download Kudu Free →What Causes This?
Windows Script Host (WSH) runs .vbs, .js, and other script files outside the browser. Attackers often abuse it to launch script-based malware from email attachments, downloads, ZIP files, or startup tasks. If you do not use legacy admin scripts or logon scripts, leaving WSH enabled gives malware one more built-in tool it can use.
Common Symptoms
- Double-clicking a
.vbsor.jsfile opens a script or error window - Suspicious script files appear in Downloads, Temp, Startup, or email attachment folders
- Antivirus alerts mention
wscript.exe,cscript.exe, VBS, or JavaScript malware - Pop-ups, fake error messages, or unwanted programs start after opening an attachment
- Scheduled tasks or startup entries keep relaunching script files
How to Fix It Manually
-
Confirm you do not need Windows Script Host
- WSH is mainly used for older admin scripts, logon scripts, and some legacy business apps.
- If your PC is managed by work or school, check with IT before disabling it.
-
Disable WSH in Registry Editor
- Press
Win + R, typeregedit, and pressEnter. - If User Account Control appears, click Yes.
- Go to:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings - If the Settings key does not exist:
- Right-click Windows Script Host
- Select New > Key
- Name it
Settings
- In the right pane, right-click an empty area and choose New > DWORD (32-bit) Value.
- Name it
Enabled - Double-click
Enabledand set Value data to0. - Click OK.
- Press
-
Also disable it for the current user
- In Registry Editor, go to:
HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings - If Settings is missing, create it the same way.
- Create a DWORD (32-bit) Value named
Enabled. - Set its value to
0. - This helps block scripts even if only the current user profile is affected.
- In Registry Editor, go to:
-
Restart the PC
- Save your work and restart Windows.
- This makes sure any running script host processes are closed and the setting is applied cleanly.
-
Test that WSH is disabled
- Press
Win + R, typecmd, and pressEnter. - In Command Prompt, run:
wscript - If WSH is disabled, Windows should show a message that access is disabled on this machine.
- Press
-
Remove suspicious script files and startup triggers
- Open Task Manager with
Ctrl + Shift + Esc, then check the Startup apps tab for unknown entries. - Press
Win + R, typeshell:startup, and pressEnter. Delete suspicious shortcuts or script files you do not recognize. - Open Task Scheduler by searching for it in Start, then review Task Scheduler Library for tasks launching
wscript.exe,cscript.exe,.vbs, or.jsfiles. - Run a full scan with Microsoft Defender: open Windows Security > Virus & threat protection > Scan options > Full scan.
- Open Task Manager with
-
Re-enable WSH only if needed
- If a legitimate app breaks, go back to the same registry locations and change
Enabledto1, or delete theEnabledvalue. - Restart the PC again after making the change.
- If a legitimate app breaks, go back to the same registry locations and change
Fix It Automatically with Kudu
Kudu can review Windows hardening settings, flag risky script-related startup items, and help apply safe fixes without digging through the registry yourself. It is a faster way to lock down common abuse points while also checking for other performance and security problems that often come with malware.
Fix this automatically with Kudu
Run a free system scan to detect and resolve this issue automatically — no manual steps required.
Download Kudu Free →Related guides
How to Detect Rootkits and Hidden Malware on Windows
Rootkits can hide deep in the system and evade normal scans, and Kudu can help you investigate signs of compromise.
How to Disable AutoRun and AutoPlay on Windows
Prevent USB and removable-drive attacks by disabling AutoRun and AutoPlay, and use Kudu to help harden Windows safely.
How to Disable SMB1 Protocol on Windows
Disable legacy SMB1 to reduce exposure to wormable network attacks, and use Kudu to help audit old Windows features.
How to Disable Telnet and Legacy Network Services on Windows
Remove outdated network features that expand attack surface, and use Kudu to help identify legacy services to disable.