Module 3: Writing Administration Scripts that use WMI
This module references what you learned in Module 2, while writing basic WMI scripts to administer IIS metabase properties. With your scripts, you will be able to query site properties, map virtual resources to real resources, create sites and set properties, export metabase nodes, use associations to find metabase elements, and use two providers in one script. The WMI SDK is used to walk you through finding the objects and methods that you need to write your WMI scripts.
This module includes the following lessons:
- Lesson 1: Simple WMI Tasks: Describes how to run a command-line administration script, the basic pattern of any simple WMI task. Also includes examples of that pattern in VBScript and JScript.
- Lesson 2: Enumerating Properties to be Displayed: Describes how to show all the properties, in VBScript and JScript, for a particular key type.
- Lesson 3: Creating Sites and Virtual Directories, and Setting Properties: Describes how to create a Web site using the new CreateNewSite method and set some basic properties, as well as use the IIS structured data class to set IP security settings and other properties.
- Lesson 4: Exporting and Importing Metabase Nodes: Describes how to use special methods to export part of the IIS metabase and import it to another IIS 6.0 Web server.
- Lesson 5: Using WMI Query Language to Find Specific Information: Describes how to search for a process ID that is unique to one unknown Web application using the WMI Query Language (WQL), instead of setting properties. This method is useful for locating a troublesome Web application on a Web server that contains too many Web applications to search through manually.
- Lesson 6: Using Associations to Find Metabase Elements: Describes how to u e the association classes to find what information is available to you.
Before You Get Started
You need a way to verify what methods and properties are available to what classes. Refer to the WMI SDK for the general WMI methods and properties. You can download the WMI SDK from Windows Management Instrumentation (WMI) SDK or view it online at Windows Management Instrumentation Platform SDK.
To verify what methods and properties are available to classes
- From the Start menu, point to All Programs, point to WMI SDK, and then click WMI SDK Documentation.
- In the left frame, double-click Windows Management Instrumentation, double-click WMI Reference, and then double-click Scripting API for WMI.
Because you are reading this page, you already have the IIS documentation open for referring to the classes, methods, and properties of the IIS WMI Provider.
If you want a reference to the language of your script, see Windows Script Documentation.
Lastly, you must have administrative privileges on the computer on which you run your WMI scripts.