The IIS installation process installs several scripts in the C:\inetpub\adminscripts directory. This month, I introduce you to two such scripts: Display Administrative Node (DispNode.vbs) and Display Administrative Tree (DispTree.vbs). You can use these two scripts to display useful information about your Web sites and services.
Both DispNode.vbs and DispTree.vbs are useful when you need to interrogate a Web site and retrieve configuration information. However, each script provides different information and performs this task in a slightly different way. DispNode.vbs displays administrative information about one node (e.g., a Web site) at a time. DispTree.vbs displays the administrative objects in a site.
These scripts can also help you obtain information about a server. For example, if you need to check the configuration of several Web servers in a farm, you can run either of these scripts remotely against those servers. You can also use the scripts to check the configuration of a new server or to audit servers and provide records of the servers at particular points in time.
You can't execute DispNode.vbs without parameters because doing so displays the syntax for the script. You must use the —a parameter to execute the script and pass in the path of the node to display. For example, you can use the command
to display information about the W3SVC on localhost. (Be aware that unlike the other characters in the path, the IIS part of the node name is case sensitive.) Figure 1 shows the output from executing this command.
The first five lines in Figure 1 identify the object that the script is querying. Note that the specified path requests information about W3SVC, not about a particular Web site. You know that the information isn't about a site because the Name attribute shows W3SVC and not the ID of a particular site. This information is the default information for all new Web sites.
To query a particular Web site, run the command
where /1 indicates the Web site in which you're interested. Figure 2, page 16, shows the output from this command. You can see that the information is quite different for a particular Web site. As the output from the second command shows, you can use DispNode.vbs to see whether a site is running. In this example, the State option shows that this Web site's state is Started. The possible values for state are
The last state (i.e., Unknown!) appears only if DispNode.vbs can't determine the state of the site. You can also use this script to see the server name (i.e., Server Comment).
You can use the other settings in Figure 2 to retrieve information about the Web site and its settings. For example, you can see what the basic security settings and log settings are.
Like DispNode.vbs, DispTree.vbs retrieves information about IIS Web sites, but a different type of information. When you execute DispTree.vbs against a server, the script retrieves a list of the IIS objects that manage the server and a small amount of other information.
To execute DispTree.vbs to display the administrative objects on the local server (localhost), type
at the command line. To execute DispTree.vbs against a particular site, type
at the command line. You can also execute the script with the —n parameter to force it not to recurse through the tree. This command generates a one-level list of the major services on the server, as Figure 3 shows. To pull information about a particular node, execute DispTree.vbs with the —a parameter and a node.
Next month, I'll show you how to modify part of the script in DispNode.vbs to monitor server state. I'll also show you how to modify the code I provide for custom use.