The Wayback Machine - https://web.archive.org/web/20121012122034/http://msdn.microsoft.com/en-us/library/a74hyyw0(d=printer,v=vs.85).aspx

Windows Script Host Object Model

Updated: April 2009

The Windows Script Host object model consists of 14 objects. The root object is the WScript object.

The illustration that follows represents the Windows Script Host Object Model hierarchy.

The Windows Script Host Object Model Hierarchy

The Windows Script Host object model provides a logical, systematic way to perform many administrative tasks. The set of COM interfaces it provides can be placed into two main categories:

  • Script Execution and Troubleshooting

    This set of interfaces allows scripts to perform basic manipulation of the Windows Script Host, output messages to the screen, and perform basic COM functions such as CreateObject and GetObject.

  • Helper Functions

    Helper functions are properties and methods for performing actions, such as mapping network drives, connecting to printers, retrieving and modifying environment variables, and manipulating registry keys. Administrators can also use the Windows Script Host helper functions to create simple logon scripts.

The following table is a list of the WSH objects and the typical tasks associated with them.

Object

What you can do with this object

WScript Object1

  • Set and retrieve command line arguments

  • Determine the name of the script file

  • Determine the host file name (wscript.exe or cscript.exe)

  • Determine the host version information

  • Create, connect to, and disconnect from COM objects

  • Sink events

  • Stop a script's execution programmatically

  • Output information to the default output device (for example, a dialog box or the command line)

WshArguments Object2

Access the entire set of command-line arguments

WshNamed Object3

Access the set of named command-line arguments

WshUnnamed Object4

Access the set of unnamed command-line arguments

WshNetwork Object5

  • Connect to and disconnect from network shares and network printers

  • Map and unmap network shares

  • Access information about the currently logged-on user

WshController Object6

Create a remote script process using the Controller method CreateScript()

WshRemote Object7

  • Remotely administer computer systems on a computer network

  • Programmatically manipulate other programs/scripts

WshRemoteError Object8

Access the error information available when a remote script (a WshRemote object) terminates as a result of a script error

WshShell Object9

  • Run a program locally

  • Manipulate the contents of the registry

  • Create a shortcut

  • Access a system folder

  • Manipulate environment variables (such as WINDIR, PATH, or PROMPT)

WshShortcut Object10

Programmatically create a shortcut

WshSpecialFolders Object11

Access any of the Windows Special Folders

WshUrlShortcut Object12

Programmatically create a shortcut to an Internet resource

WshEnvironment Object13

Access any of the environment variables (such as WINDIR, PATH, or PROMPT)

WshScriptExec Object14

Determine status and error information about a script run with Exec()

Access the StdIn, StdOut, and StdErr channels

In addition to the object interfaces provided by Windows Script Host, administrators can use any ActiveX control that exposes automation interfaces to perform various tasks on the Windows platform. For example, administrators can write scripts to manage the Windows Active Directory Service Interface (ADSI).

Date

History

Reason

April 2009

Added links to listed objects.

Customer feedback.

Links Table
1http://msdn.microsoft.com/en-us/library/at5ydy31(v=vs.85).aspx
2http://msdn.microsoft.com/en-us/library/ss1ysb2a(v=vs.85).aspx
3http://msdn.microsoft.com/en-us/library/d6y04sbb(v=vs.85).aspx
4http://msdn.microsoft.com/en-us/library/ah2hawwc(v=vs.85).aspx
5http://msdn.microsoft.com/en-us/library/s6wt333f(v=vs.85).aspx
6http://msdn.microsoft.com/en-us/library/xk7bxb0d(v=vs.85).aspx
7http://msdn.microsoft.com/en-us/library/x9t3ze5y(v=vs.85).aspx
8http://msdn.microsoft.com/en-us/library/d02b3e15(v=vs.85).aspx
9http://msdn.microsoft.com/en-us/library/aew9yb99(v=vs.85).aspx
10http://msdn.microsoft.com/en-us/library/xk6kst2k(v=vs.85).aspx
11http://msdn.microsoft.com/en-us/library/9x9e7edx(v=vs.85).aspx
12http://msdn.microsoft.com/en-us/library/265a4017(v=vs.85).aspx
13http://msdn.microsoft.com/en-us/library/6s7w15a0(v=vs.85).aspx
14http://msdn.microsoft.com/en-us/library/2f38xsxe(v=vs.85).aspx
Community Content Add
Annotations FAQ