Chapter 40: Automating Tasks with the Windows Script Host
What Is the Windows Script Host? Windows XP, like previous desktop versions of Windows, comes with the Windows Script Host (WSH), a program that can run scripts from either DOS or Windows. A script is a file containing a series of commands, like a batch file that you can use to automate tasks that you repeat often. Administrators of large Windows installations find scripts invaluable for creating and maintaining standard Windows configurations.
For example, if you administer a large Windows installation, you can write a script that logs onto your organization's LAN, connects to various servers, and runs other housekeeping programs. You can use Scheduled Tasks and WSH to run the script on a schedule. Alternatively, you can configure Windows to run WSH and the script automatically when Windows starts up.
WSH can run scripts written in a variety of languages, including VBScript (the scripting language used by Internet Explorer) and JavaScript (what Microsoft calls JScript). The makers of other scripting languages may also provide programs that will allow WSH to run scripts in their languages (Microsoft hopes that they do). Scripts are stored in text files that you can look at using Notepad or WordPad.
This chapter doesn't describe the VBScript or JavaScript languages; we suggest that you buy a book about the programming language you choose. Instead, this chapter describes how to use WSH to run scripts after you've written them.
For more information about WSH, visit its Web sites at http://www.microsoft.com/windows2000/en/professional/help/wsh_overview.htm and http://msdn.microsoft.com/scripting.
WSH can run scripts that are more powerful than batch files and can do a lot of damage. Viruses like the notorious ILOVEYOU virus use WSH as part of their system of infection and propagation. Checking the source and trustworthiness of the scripts you run is vitally important.