Scriptable objects in Windows 2000

Windows 2000 has great scripting support. Two scripting languages, VBScript and JScript, are included out of the box, and you can write script in these languages that runs from the command shell, from the Explorer, or on web pages using ASP.  The standard availability of these languages with Windows 2000 makes them the Windows equivalent of Perl on Unix: You can whip out little scripts to do system administration jobs in either language fairly quickly.

Windows scripting languages don't really have any services that are built into the language: They use COM objects for all their interaction with the user and the system.  Scripts have access to any scriptable COM object, and there are hundreds (thousands?) of these on even the most basic Windows installation.  There is no single place where you can read about all of the objects available to you, however, and that's what this page is: a quick reference to Windows scripting objects.

(These objects are all scriptable, but they're also available to any program written in VB, C++,  Java (using the Microsoft Java VM), or any other language that gives you access to COM objects).

Object names in bold are objects that I've frequently had to work directly with, so they're ones that I think are especially useful or important.  Others are often included simply for completeness (or I just haven't found much use for them yet).

ADO

ActiveX Database Objects - this is your main way to get ahold of data from a database.  There's a lot of ADO documentation on Microsoft's website, check the main ADO site and explore from there.

Object Name Description Reference
ADODB.Command Defines a specific command that you intend to execute against a data source. Properties, Methods, and Events
ADODB.Connection Represents an open connection to a data source. Properties, Methods, and Events
ADODB.Error Contains details about data access errors that pertain to a single operation involving the provider. Properties, Methods, and Events
ADODB.Field Represents a column of data with a common data type. Properties, Methods, and Events
ADODB.Parameter Represents a parameter or argument associated with a Command object based on a parameterized query or stored procedure. Properties, Methods, and Events
ADODB.Property Represents a dynamic characteristic of an ADO object that is defined by the provider. Properties, Methods, and Events
ADODB.Record Represents a row of a Recordset, or a directory or file in a file system. Properties, Methods, and Events
ADODB.Recordset Represents the entire set of records from a base table or the results of an executed command. At any time, the Recordset object refers to only a single record within the set as the current record. Properties, Methods, and Events
ADODB.Stream Represents a binary stream of data. Properties, Methods, and Events

CDO

WScript

WShell

Scripting

The WScript object is globally available in script code running in either the WScript.exe script host (which outputs to Windows dialogs) or the CScript.exe host (which outputs to the command shell).  The rest of them are available anywhere.

Object Name Description Reference
WScript Provides access to the context of the scripting host (ie, letting you print output or get at environment variables).  This object is globally available in scripts run by wscript or cscript and isn't directly creatable (ie, not ASP). Properties, Methods
Scripting.FileSystemObject Provides access to files (especially text files) and FileSystem operations in general like deleting files and getting directory listings. Properties, Methods
WScript.Shell Starts a new process, creates shortcuts, and provides the Environment collection to handle environmental variables such as WINDIR, PATH, or PROMPT. Properties, Methods

ASP

These objects are available within ASP pages, and aren't usable outside the context of a page - you can't create these objects, but they're available to you if your script is running in an ASP webpage.  Each of these pages has all the information you need, so there is no separate column for properties, methods, etc.

Object Name Description
Application You can use the Application object to share information among all users of a given application. An ASP-based application is defined as all the .asp files in a virtual directory and its subdirectories.
ASPError You can use the ASPError object to obtain information about an error condition that has occurred in script in an ASP page. The ASPError object is returned by the Server.GetLastError method.
Request The Request object retrieves the values that the client browser passed to the server during an HTTP request.
Response You can use the Response object to send output to the client.
Session You can use the Session object to store information needed for a particular user-session. Variables stored in the Session object are not discarded when the user jumps between pages in the application; instead, these variables persist for the entire user-session.
Server The Server object provides access to methods and properties on the server. Most of these methods and properties serve as utility functions.
ObjectContext You can use the ObjectContext object to either commit or abort a transaction, managed by Component Services, that has been initiated by a script contained in an ASP page.

XML

There are many XML objects that Microsoft gives you (listed here) but they are all accessible through the objects in the table below.  You create the Document object, and then you use it to query for the other objects.  In my own ASP code I've always used the free threaded version, and set the async property to false so that the data is loaded "while I wait".

Object Name Description
Microsoft.XMLDOM This object represents the top node in the tree. It implements all of the base DOM document methods and provides additional methods and properties that support XSL and XML transformations.
Microsoft.FreeThreadedXMLDOM This is a free-threaded version of exactly the same object above. 

MSHTML

The MSHTML object (or the WebBrowser control as they call it) is Internet Explorer.  It's an incredibly powerful control in that you can add browser functionality to your application very easily - but unfortunately for scripting, the control insists on throwing up dialogs even when you tell it not to in the case of critical errors - this makes it difficult to use for anything other than interactive web browsing.  There are a lot of interfaces  and objects involved in using MSHTML; there'a whole list of them here.

Object Name Description Reference
InternetExplorer.Application The InternetExplorer object controls a remote instance of Microsoft® Internet Explorer through Automation.  

Miscellaneous Links:

Many Microsoft Links on One Page