Windows Script Host Error: 6 Ways to Fix It for Good

Misconfiguration of the Registry may prompt this error

Reading time icon 5 min. read


Readers help support Windows Report. We may get a commission if you buy through our links. Tooltip Icon

Read our disclosure page to find out how can you help Windows Report sustain the editorial team Read more

Key notes

  • Windows Script Host errors can occur in different varieties, accompanied by varying messages.
  • The problem may be due to corrupt system files, issues with the Visual Basic Scripting files, and Windows Registry errors.
  • Try running SFC & DISM scans, tweaking the VBS file values in the Registry Editor, and scanning the system for viruses and malware.
windows script host errors

Windows Script Host error is one of the recent errors users have been complaining about when booting. The error occurs when the Windows Script Host fails to read a particular script file or encounters any other issue.

Likewise, users report having issues with random Command Prompt opening and closing on their PCs.

What causes Windows Script Host errors?

Windows Script Host error occurs in varieties, making it different in some computers. It can appear as Windows Script Host the system cannot find the file specified, and Windows Script Host permission denied. Some of the causes are:

  • Virus and malware attacks – The activities of the Windows Script Host tool may be affected by viruses and malware attacks on your computer. They can infect the crucial system files responsible for the tasks you’re trying to perform with malicious code, resulting in errors.
  • Issues with the VBS script file – The VBS script file stores VBScript or Visual Basic Scripting codes in Windows PCs that the Windows Script Host tool interprets and runs. So, any damage or interference with the VBS script file can impede the process, preventing Windows Script Host from functioning correctly.
  • Windows Registry errors – The error may pop up when the concerned file isn’t accessible in the Registry directory. Also, installing new programs by overwriting the old programs can cause problems with the files in the registry, impeding the hosting tool from running.
  • Corrupt system files – When essential system files are corrupted, it affects how several components of the system work, including the Windows Script Host tool.

These causes are likely to vary depending on the Windows Script Host error message you get. Nevertheless, follow the basic steps we’ll discuss as we go further to fix them.

How can I fix Windows Script Host errors?

Before proceeding with any advanced troubleshooting steps, try the following:

If the error persists, try the solutions below:

1. Run the SFC and DISM to repair damaged system files

  1. Left-click the Start button, type Command Prompt, then click Run as administrator.
  2. Click Yes on the User Account Control (UAC) prompt.
  3. Type the following and press Enter:  sfc /scannow
  4. Type the following commands and press Enter after each: DISM /Online /Cleanup-Image /RestoreHealth
  5. Restart your PC and check if the error still appears.

Running SFC and DISM scan on your PC can diagnose and repair corrupted Windows system files causing the Windows Script Host 80070002 error.

Read how to fix the run as administrator option if it’s not working on Windows 11.

2. Change the Default Value of the VBS file

  1. Press Windows + R key to open the Run dialog box, type Regedit, and press OK to open the Registry Editor.
  2. Navigate to: Computer\HKEY_CLASSES_ROOT\.vbs
  3. Double-click the Default key on the right-hand pane to open it. Change the Value data to VBSfile, then press OK to save these settings.
  4. Exit the Registry Editor and restart your PC to check if the error appears.

Tweaking the value for the VBS file in the Registry Editor will fix configurations causing the Windows Script Host error.

3. Run Windows Defender scan to remove viruses and malware

  1. Left-click the Start button, type Windows Security, then click Enter to open it.
  2. Click on Virus & Threat Protection and select the Scan option link.
  3. Then select Full scan to initiate an extensive scan and click the Scan now button and wait while the scan completes.

Running Windows Defender scan will detect and remove any malware and viruses affecting your system performance. Read how to fix the Windows virus and threat protection not working on Windows 11.

4. Enable Windows Script Host via the Registry Editor

  1. Press Windows + R key to open the Run dialog box, type Regedit, and press OK to launch the Registry Editor.
  2. Navigate to the following path: HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings
  3. Double-click the Enabled key on the right pane to open it. Set the Value data to 1.
  4. If the Enabled key is missing, create it by right-clicking on an empty space on the right side of the screen, select New, then DWORD (32-bit) Value.
  5. Name the new value as Enabled and then click OK.
  6. Double-click on the value and set its Value data to 1.

Since the error can occur if the Windows Script Host tool is disabled on your PC, enabling it will fix the issue.

5. Remove Registry Values after Userinit.exe

  1. Press Windows + R key to open the Run dialog box, type Regedit, and press OK to launch the Registry Editor.
  2. Copy and paste the following in the search bar to go to the directory: Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
  3. On the right pane, scroll down to Userinit and delete any keys lined below it.

Deleting the following keys that appear after Userinit will resolve any interference they cause. Read about how to fix a corrupt Registry Editor on Windows 11 if you run into a problem.

6. Run System Restore

  1. Press Windows + R key to open the Run dialog box, type control, then press Enter to open the Control Panel.
  2. Type recovery in the Control Panel search bar and select Recovery.
  3. Then click Open System Restore.
  4. Click Next in the Restore system files and settings window.
  5. Choose the restore point you want to restore from, then click Scan for affected programs.

Running a System Restore will restore the system to an earlier point, removing recent activities that may be associated with the error.

Do not hesitate to read our guide on how to fix Restore Point if it’s not working on your PC. In addition, we have an extensive guide on fixing the Run.vbs error on Windows 11.

If you have further questions or suggestions, kindly drop them in the comments section.

More about the topics: Windows 11