Metabase 101
The Metabase. What is it? What does it do? What you need to know if you plan on writing any automation in IIS.
Let's take a tour of the Metabase.
|
The Metabase is used as a repository for most of - 98% - Internet Information Services's (IIS) configuration parameters. The Metabase is based on a hierarchical design with inheritance. It is fast and compact and, surprisingly, based on some things that Microsoft introduces, easy to follow, access and program.
Upon opening the Metabase you are presented with the image below. Notice the LM which stands for Local Machine. This is an object. Also, notice the object's KeyType: IIsComputer. Each object in the Metabase is defined by one KeyType.
Let's now further traverse the Metabase by clicking on the LM object. We are presented with more objects. Of particular note too are the index values 1 thru 9. These index values actually represent the Web sites you create in IIS whether you created them using the MMC or programmatically.
Let's open the W3SVC object (this is the World Wide Web Publishing Service) and note this Object's
KeyType: IIsWebServer.
Beginning to see the pattern? :)

Ok, we're almost there. This is almost too easy.
Opening the Index value 1 we discover a very familiar world.
First, look at the KeyType: IIsWebServer.
Ahhh, we finally made it! Yes, this is an actual Web site. Specifically, this is the Default Web site in IIS. Your Metabase properties for this site, most likely, mirror mine since IIS creates this by default.
Let's move ahead just a little AND HAVE SOME FUN!
To access this site using vbscript you would code this as:
Dim Parent
Dim ServerName
Dim SiteIndex
SiteIndex = "1"
ServerName = "www"
Set Parent = GetObject("IIS://" & ServerName & "/W3SVC/" & SiteIndex) |
Now by accessing the Parent Object (or, Container) you can extract the different parameters like the:
- ServerComment
- ServerState
- ServerBindings
and take action on these parameters to add, change or delete the values. We'll take a closer look at this later.
Further traversal of the Metabase takes us to the ROOT virtual directory. When a Web site is created in IIS a ROOT virtual directory is created. This ROOT virtual directory, as well as all virtual directories, will be assigned the KeyType: IIsWebVirtualDir.

Try this out:
- Open the Metabase,
- Open the LM://W3SVC/1/ROOT
- Open the MMC and
- Open the properties sheet for the Default web site
- Click on the Home Directory
Now, compare the values in the Metabase with the values in the MMC. My two images above depict this exercise BTW.
Note the similarities in each value.
Now try this:
- In the MMC change a value, say, the Application name
- Click Apply
- In the Metabase click View and then Refresh
So, let's just say your aim is to programmatically change the AppFriendlyName, you would do it like this:
Dim Parent
Dim ServerName
Dim SiteIndex
SiteIndex = 1
ServerName = "www"
Set Parent = GetObject("IIS://" & ServerName & "/W3SVC/" & SiteIndex & "/ROOT" )
Parent.AppFriendlyName = "DOGRAT"
Parent.SetInfo
|
Stay tuned for Metabase 102. Metabase 102 will concentrate on stepping through, line by line, the vbscript code used to automate functions in IIS.
If you like this article or maybe had a similar experience and would like to share it with other readers then feel free to:
Simply fill in YOUR e-mail address, your name and your comment. Click the SEND button.After submitting your comment, you will be transported back to the article you commented on!
John Cesta is a contract programmer. John's current project is designer and lead developer of the automated hosting software at bestcfhosting.com, a ColdFusion MX hosting company. John is currently working on commercializing his programs and offering them to the IIS community at serverautomationtools.com

