If you see “Windows Script Host access is disabled on this machine” when trying to run a .vbs or .js script on Windows 10, the fix is to re-enable the Windows Script Host setting in the Registry or Group Policy. This article explains why the error appears, how to safely resolve it, and how to prevent it from coming back.
What Causes the Error
Windows Script Host (WSH) is a built-in Windows component that runs scripts written in VBScript (.vbs) and JScript (.js). The error message appears when WSH has been disabled, either by a system administrator, a security policy, or by malware that modified the registry to block script execution.
The most common registry keys that control WSH are:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Script Host\Settings\Enabled— set to0disables WSH for all users.HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows Script Host\Settings\Enabled— set to0disables WSH for the current user only.
When either of these values is set to 0, any attempt to run a .vbs or .js file will trigger the error. The setting can also be enforced through Group Policy, which overrides the registry.
How to Re-enable Windows Script Host via Registry
If you have administrator access, you can re-enable WSH by editing the registry. Follow these steps carefully:
- Press Win + R, type
regedit, and press Enter. If prompted by User Account Control, click Yes. - Navigate to the following key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Script Host\Settings - If you see a value named Enabled on the right side, double-click it and set its value to
1. If it does not exist, right-click in the empty space, select New > DWORD (32-bit) Value, name itEnabled, and set it to1. - Repeat the same steps for the
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows Script Host\Settingskey. - Close the Registry Editor and restart your computer (or at least sign out and back in).
After restarting, try running the script again. If the error persists, the setting may be enforced by Group Policy.
How to Re-enable via Group Policy
If your Windows 10 edition is Pro, Enterprise, or Education, you can use the Local Group Policy Editor to change the WSH setting. Home editions do not include this tool, so you would need to use the registry method instead.
- Press Win + R, type
gpedit.msc, and press Enter. - Navigate to:
Computer Configuration \ Administrative Templates \ Windows Components \ Windows Script Host - Double-click the policy Turn off Windows Script Host.
- Set it to Not Configured or Disabled, then click OK.
- Also check
User Configuration \ Administrative Templates \ Windows Components \ Windows Script Hostand apply the same setting. - Run
gpupdate /forcein Command Prompt (as administrator) to apply the changes immediately.
What to Do If the Error Appears Only for One Script
Sometimes the error is not global but appears only when you run a specific .vbs or .js file. This can happen if the file itself contains a line that attempts to disable WSH, or if the file is corrupted. Before re-enabling WSH system-wide, try these steps:
- Check if the script is digitally signed and whether the signature is valid. Unsigned scripts may be blocked by a security policy.
- Open the script in Notepad and look for any line that sets
Enabledto0in the registry. If you find such a line, remove it and save the file. - Run the script from an elevated Command Prompt to see if permissions are the issue.
If the script is from an untrusted source, do not run it even after re-enabling WSH. The error message is often a security measure, and disabling it blindly can expose your system to malicious scripts.
Common Misconception: Is WSH a Security Risk?
Many security guides recommend disabling Windows Script Host to prevent malware from running scripts. While it is true that some malware uses WSH, disabling it entirely also breaks legitimate scripts that many users rely on for automation, logon scripts, and system administration tasks. The safer approach is to keep WSH enabled but ensure that scripts are only run from trusted sources, and that your antivirus software is up to date.
If you are in a corporate environment, your IT department may have disabled WSH intentionally to enforce security policy. In that case, you should contact your IT support rather than changing the setting yourself, as it may violate company policy.
How to Test If WSH Is Working
After making the changes, you can quickly test whether WSH is enabled by creating a simple script:
- Open Notepad and type:
MsgBox "WSH is working" - Save the file as
test.vbs(make sure the file extension is .vbs, not .txt). - Double-click the file. If a message box appears, WSH is enabled.
If the error still appears, double-check the registry values and group policy settings. Also, some third-party security software may block WSH even if Windows settings are correct. Temporarily disabling such software (if safe) can help diagnose the issue.
Frequently Asked Questions
Why did this error suddenly appear on my PC?
The most common causes are a recent security update, a policy change by an administrator, or malware that modified the registry. It can also happen after installing certain software that disables WSH as a precaution.
Can I fix this without editing the registry?
Yes, if you have Windows Pro or Enterprise, you can use Group Policy as described above. For Home editions, the registry is the only built-in method, but you can also use a .reg file to change the value automatically (if you know the correct key).
Is it safe to re-enable Windows Script Host?
Generally yes, as long as you are careful about which scripts you run. Re-enabling WSH does not make your system inherently vulnerable; it simply allows scripts to run. Always scan scripts with antivirus before executing them.
What if the registry key doesn’t exist?
If the Settings key does not exist, you need to create it. Right-click on Windows Script Host (or Microsoft if the former is missing), select New > Key, name it Settings, and then create the Enabled DWORD inside it.
Will this fix affect other programs?
Re-enabling WSH will allow all .vbs and .js scripts to run again, which could affect programs that rely on those scripts. Most legitimate software does not depend on WSH, so the impact is usually minimal. However, if you are in a managed environment, check with your IT department first.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- How to Use Multiple CSS Transforms
- How to Delete iOS Calendar Viruses
- How to Spoof Location on iPhone
- iOS App Testing on Multiple Devices: A Guide
- How to Enable Live Captions in Chrome
- X Bar Symbol in Word: 3 Quick Typing Methods