Windows Script Host (WSH)

Last Edited

by

in

Definition of Windows Script Host (WSH) in Network Encyclopedia.

What is Windows Script Host?

Windows Script Host, or WSH, is a language-independent scripting host included with Microsoft Windows Operating Systems that allows administrators to execute scripts for administrative tasks either from the command console (using cscript.exe) or by double-clicking on a desktop shortcut (using wscript.exe).

Windows Script Host (WSH)
Windows Script Host (WSH)

This tool was first provided on Windows 95 after Build 950a on the installation discs as an optional installation configurable and installable by means of the Control Panel, and then a standard component of Windows 98 (Build 1111) and subsequent and Windows NT 4.0 Build 1381 and by means of Service Pack 4.

The WSH is also a means of automation for Internet Explorer via the installed WSH engines from IE Version 3.0 onwards; at this time VBScript became means of automation for Microsoft Outlook 97. The WSH is also an optional install provided with a VBScript and JScript engine for Windows CE 3.0 and following and some third-party engines including Rexx and other forms of Basic are also available.

Administrative scripts can be written in Microsoft Visual Basic, Scripting Edition (VBScript), or in Microsoft JScript and can be written to perform common or repetitive administrative tasks such as performing a backup, creating new users, and configuring clients. Windows Script Host (WSH) allows these scripts to be run without being embedded in a Hypertext Markup Language (HTML) document. You can also add support for other scripting languages, such as Perl or REXX.

Configuring Scripts

You can configure how scripts are run by using .wsh files, which are created automatically when you access the properties of a VBScript or JScript file on a system with WSH installed. These .wsh files act like INI files, enabling you to configure settings such as how long a script should be allowed to run before being terminated. You can create a series of different .wsh files for a given script and use these in different situations. Double-click on a .wsh file to run the associated script.

Security Issues

Windows applications and processes may be automated using a script in Windows Script Host. Viruses and malware could be written to exploit this ability. Thus, some suggest disabling it for security reasons. Alternatively, antivirus programs may offer features to control .vbs and other scripts which run in the WSH environment.

Since version 5.6 of WSH, scripts can be digitally signed programmatically using the Scripting. Signer object in a script itself provided a valid certificate is present on the system. Alternatively, the signcode tool from the Platform SDK, which has been extended to support WSH filetypes, may be used at the command line.

Windows Script Host disable
Windows Script Host disable

By using Software Restriction Policies introduced with Windows XP, a system may be configured to execute only those scripts which are stored in trusted locations, have a known MD5 hash, or have been digitally signed by a trusted publisher, thus preventing the execution of untrusted scripts.

Removing Windows Scrip Host error

Windows Scripting Host error
Windows Scripting Host error
https://youtu.be/SjpuAb2bVr4
Windows Scrip Host error

Check this article with a step-by-step guide on how to fix Windows Script Host on startup.

Windows Script Host Examples

The first example is very simple; it shows some VBScript which uses the root WSH COM object “WScript” to display a message with an ‘OK’ button. Upon launching this script the CScript or WScript engine would be called and the runtime environment provided.

Content of a file hello0.vbs

WScript.Echo "Hello world"
WScript.Quit

WSH programming can also use the JScript language.

Content of a file hello1.js

WSH.Echo("Hello world");
WSH.Quit();

See also:

Search