How to enable or disable Windows Script Host on your PC?

Windows Script Host (WSH) Windows feature that allows you to run scripts written in VBScript or JavaScript . These scripts can be used to automate tasks, modify system settings or even launch applications. However, WSH can also be exploited by malware that seeks to infect your computer or encrypt your files. This is why it is recommended to disable WSH if you don't need it or don't know what you are doing.

In this article, we will explain how to enable or disable WSH on Windows 10, 8 and 7, as well as the advantages and disadvantages of doing so.

What is Windows Script Host?

GetPaidStock.com 64838dc05ad1eWindows Script Host (WSH) is an interface that allows you to run scripts written in VBScript or JavaScript on Windows . These scripts are generally stored in files with the .vbs or .js extension, but they can also be embedded in Microsoft Office documents (Word, Excel, etc.) or in web pages.

WSH provides the ability to manipulate operating system objects, such as the registry, files, folders, processes or services. It also provides access to COM (Component Object Model) components, which are reusable and interoperable software modules.

WSH can be used to automate repetitive tasks, modify system settings or even launch applications. For example, you can create a script that cleans your hard drive, changes your wallpaper, or opens your favorite web browser.

How to enable or disable Windows Script Host?

There are several methods to enable or disable WSH on Windows . We'll show you the two simplest ones: modifying the registry and using antivirus software.

Edit Registry

The registry is a database that contains system settings and installed applications on Windows . It is possible to modify the registry to enable or disable WSH.

To do this, follow these steps:

  • Open the Start menu and type regedit in the search bar. Click on the regedit.exe program icon that appears.
    tth img w10 startmenu search regedit
  • In the registry window, navigate to the following key: HKEY_LOCAL_MACHINE\Software\Microsoft\ Windows Script Host\Settings
  • In the right pane, double-click the value named Enabled. If it doesn't exist, right-click an empty space and choose New > DWORD (32-bit) Value. Name it Enabled.
    tth img w10 regedit Win Script Host new
  • In the dialog box that opens, modify the value data according to your choice:
    • To enable WSH, type 1 and click OK.
    • To disable WSH, type 0 and click OK.
  • tth img w10 regedit Win Script Host new 0
    Close the registry window and restart your PC for the changes to take effect.

Use antivirus software

Another method to enable or disable WSH is to use antivirus software that offers this option. For example, you can use Smadav, a free and lightweight antivirus that protects your PC against USB viruses and malicious scripts. You can temporarily disable Windows Defender if there is a conflict between the two software programs.

To enable or disable WSH with Smadav, follow these steps:

  • Download and install Smadav on your PC from the official website: https://smadav.net/
  • Open Smadav and click on the Smadav icon in the taskbar.
  • Select Allow Windows -Script & Office-Macro (Until Restart) to enable WSH. Uncheck this box to disable WSH.
    tth img w10 app smadav Win Script Host active
  • Restart your PC for the changes to take effect.

What are the advantages and disadvantages of enabling or disabling Windows Script Host?

Enabling or disabling WSH has advantages and disadvantages depending on how you use your PC. Here is a summary of the main points to consider:

BenefitsDisadvantages
Enable WSH– Allows you to run useful scripts to automate tasks, modify system settings or launch applications.
Disable WSH– Protects your PC from malware that exploits WSH to infect your computer or encrypt your files.

FAQs

Here are some frequently asked questions about Windows Script Host:

Why disable Windows Script Host?

  • WSH can be useful for some advanced users, but it can also pose a security risk to your computer.
  • WSH can be exploited by malware that seeks to infect your PC or encrypt your files.
  • These malware can appear as email attachments, booby-trapped Office documents, or infected web pages. They can also be hidden in compressed files (zip, rar, etc.) or in USB keys.
  • If you open these files carelessly, you risk running a malicious script that will modify your registry, disable your antivirus, download other malware or even encrypt your personal data.
  • It is recommended to disable WSH if you don't need it or don't know what you are doing. This will prevent your PC from being compromised by a malicious script.

How do you know if a script is malicious?

There is no foolproof way to detect a malicious script, but there are a few precautions you can take:

  • Do not open attachments in emails from unknown or suspicious senders.
  • Do not open Office documents that contain macros without verifying their source and content.
  • Do not visit web pages that display alerts or error messages asking you to run a script.
  • Do not plug in USB keys whose origin or contents you do not know.
  • Scan your PC regularly with up-to-date antivirus software.

How do I remove a malicious script that has infected my PC?

If you suspect your PC has been infected with a malicious script, you should act quickly to limit the damage. Here are some steps to follow:

  • Disconnect your PC from the internet and any local network.
  • Disable WSH by following the methods described above.
  • Run a full scan of your PC with up-to-date antivirus software. If possible, use an antivirus that can detect and remove malicious scripts, like Smadav.
  • Restore your files from a recent backup if you have one. Otherwise, try using data recovery software, like Recuva.
  • Change all your passwords and check your online accounts for suspicious activity.

How do I create my own scripts with Windows Script Host?

If you want to create your own scripts with WSH, you need to have knowledge of VBScript or JavaScript, as well as Windows programming.

  • To create a script with WSH, you must create a text file with the extension .vbs or .js depending on the language you are using. You can use any text editor, such as Notepad or Notepad++.
  • In the text file, you must write the code of your script respecting the syntax and rules of the chosen language. You can use comments to explain how your script works or to skip certain lines of code.
  • To run your script, you need to double-click the file or drag and drop it onto the WSH icon. You can also use the wscript.exe or cscript.exe command in the Command Prompt.

To debug your script, you can use statements like MsgBox or WScript.Echo to display messages on the screen or in the console. You can also use a text editor that offers debugging features, like Visual Studio Code, which can help you fix error 0xc000007b on Windows .

Here is an example of a VBScript script that displays “Hello world!” in a dialog box:

' This is a comment Option Explicit ' Forces declaration of Dim message variables ' Declares a message variable = "Hello world!" ' Assigns a value to the MsgBox message variable ' Displays the value of the variable in a dialog box 

To copy

Here is an example of a JavaScript script that displays “Hello world!” in the console:

// This is a comment var message; // Declare a variable message = "Hello world!"; // Assign a value to the variable WScript.Echo(message); // Display the value of the variable in the console 

Conclusion

Windows Script Host is a Windows feature that allows you to run scripts written in VBScript or JavaScript. These scripts can be useful for automating tasks, changing system settings, or launching applications. However, they can also be dangerous if you open files containing malicious scripts that seek to infect your PC or encrypt your files.

This is why it is recommended to disable WSH if you don't need it or don't know what you are doing. You can enable or disable WSH by editing the registry or using antivirus software like Smadav.

If you want to create your own scripts with WSH, you need to have knowledge of VBScript or JavaScript, as well as Windows programming. You need to create a text file with .vbs or .js extension and write your script code in it. You can run, debug and test your script with WSH.

We hope this article helped you understand how to enable or disable WSH on your PC. If you have any questions or comments, do not hesitate to leave them to us in comments.

Previous article How to install Discord on PS4?
Next article How to reset a Philips TV without a remote control?
Hello me, it's François :) Editor in my spare time who loves sharing his passion: TT High tech! 😍 Whether it's hardware, software, video games, social media and many other areas on the site. I share with you my analyses, my tests, tutorials and my favorites on various media. I am a knowledgeable and demanding technophile, who does not just follow fashion, but who seeks to guide you towards the best solutions. So stay tuned!