Data Centers

Back up and tweak IIS settings using MetaEdit

Just as the registry is the heart of Windows 2000, the metabase is the heart of your IIS server. If you need to do heart surgery, Dave Mays shows you the tool to use: MetaEdit.

Most of your IIS administration duties involve using the Internet Services Manager (ISM). However, ISM can’t do everything. If you want to back up and restore IIS, or tweak its performance, you must get into the heart of IIS—the metabase. For that you need MetaEdit. In this Daily Feature, I’ll show you how to obtain and use MetaEdit 2.2.

The metabase holds IIS’s configuration settings
The metabase is the database of configuration settings for the IIS server. It contains objects with containers, and some keys and values that have been added for expert use. The metabase file is located in the Inetsrv folder where IIS is installed. IIS loads Metabase.bin and keeps it in memory until the Web server is shut down.

The metabase is similar in layout to the registry. Why does the metabase feel like the registry? Well, that’s where it used to reside. If you’ve ever used IIS 3.0 or a previous version of IIS, you know that the server would place a new tree in the system registry every time you added a Web site to your server. This caused the registry to grow in size as you added more sites and settings.

Microsoft quickly discovered that building on the system registry wasn’t the best solution. It was looking for a way to make its Web server competitive with the UNIX systems of the time, and using the registry API wasn’t an efficient enough method to handle a large load of queries to the system database. To make IIS more scalable, Microsoft moved the entries to its own specialized database, the metabase.

Just like the registry, the metabase is a hierarchical structure that is set up just like your IIS configuration. It contains nodes, each of which has keys. In the keys are values that make up the properties of your server configuration. These are called metabase properties. Each key contains the settings for each configuration of the site within the server. However, these values are inherited from the parent. This means that any configuration set in a higher node will apply to the lower levels of the metabase. This only occurs if a value is NOT set for the lower value; inheritance is from the top down, node to key, but processing is from the bottom up, from key to node. If a value is set within a particular site, the inherited value is ignored.

Get MetaEdit
Ordinarily, you’d use the Internet Services Manager (ISM) to make most changes to IIS settings. However, to make changes to the metabase, you need the help of a power tool. Since Regedit.exe doesn’t handle the metabase, you need a different program, one called MetaEdit.

You can obtain MetaEdit two ways. First, you can get it from the Windows 2000 Server Resource Kit. Be careful when you use the version of MetaEdit that comes with the Resource Kit. Some versions of the Resource Kit come with MetaEdit 2.0. I discourage you from using this version because it has some known issues and lacks critical functionality.

The second and better way to get MetaEdit is directly from Microsoft’s MetaEdit Web site. This ensures that you have the latest version of MetaEdit, currently the new 2.2 version. Some of the key benefits of MetaEdit 2.2 are:
  • You can back up and restore the metabase.
  • You can export and import keys, including the ability to export a key from one server and import it on another.
  • You can encrypt information using the CryptoAPI.
  • Cyclical redundancy check (CRC) checks to ensure metabase integrity.

Install MetaEdit
After you’ve downloaded the executable from Microsoft, click the MetaEdit icon. The install process is fairly straightforward. After accepting the EULA, you’ll be prompted with a standard Visual Basic install screen. Although this is slightly different from most Windows installation wizards, the rest of the installation program works like every other wizard you’ve ever used. You can select the directory to store the MetaEdit files. You can also choose the group to store the MetaEdit startup icon. When the wizard finishes, you’re ready to run MetaEdit. To start MetaEdit, click Start | Programs | Administrative Tools | MetaEdit.

Danger, Will Robinson!
A word of warning. Like playing around with the Windows 2000 system registry, editing the metabase is not for the careless. If you want to tinker with the metabase values, I suggest you do it on a non-production machine. Altering the entries can be devastating to your server: there are NO safeguards. You’re putting your hand in the blades of a running lawnmower. Make sure you have a backup of your server before making any changes.

Backing up the metabase
Before you do anything, back up your server’s metabase. Do NOT skip this step, or you could be risking death—of your server at least, and possibly your career. Here are a few notes about backups:
  • Make routine backups of your metabase. Since the file is always in use, most automated backup programs might not back up the metabase file.
  • Backups can’t be used if you reinstall the OS, and they can’t be used on another server: you have to use import/export for that functionality.
  • The backups are put into the default directory in Systemroot\System32\InetSrv\MetaBack.

In the Metabase | Backup/Restore menu, you can create, restore, or delete a backup. Click on Create, give the backup a name, and select OK. MetaEdit will then back up your metabase.

You can do a restore by selecting which backup to restore and selecting Restore. The restore process can take a few minutes, and you may get weird errors saying the application is in use—just keep retrying and eventually it will work. You can also manage your backups from the backup screen by deleting out-of-date ones.

Looking at the metabase
After you’ve completed your metabase backup, you can start looking at the values that are contained within the metabase. As I noted, the layout is similar to the registry, as shown in Figure A.

Figure A
The MetaEdit screen will remind you of editing the registry, but with different nodes.

The nodes LM and Schema in the left-hand side are the two different root nodes inside the metabase. The LM refers to the current machine, the Local Machine, and Schema is the node for the layout of your key values. The LM node contains your server layout. You’ll see the following nodes:
  • W32SVC for Web sites
  • NNTPSVC for news servers
  • MSFTPSVC for FTP sites
  • SMTPSVC for mail servers

If you expand the W32SVC node, you’ll see a list of numbers. These numbers represent your sites in the node, as shown in Figure B. Each of the other nodes for Web services contains similar numbers.

Figure B
Your individual sites are labeled with numbers and not the site name.

In Figure B, the value of \\LM\W32SVC\1\ServerComment is Default Web Site. This tells you which site you’re editing. If you have a large number of sites, you can also execute an ASP script (findweb.vbs) from the command line. The script is sometimes found in different locations based on what version of IIS you have installed.

To run the script, open a command prompt on your server, type C:\>cscript c:\Inetpub\AdminScripts\findweb.vbs Default Web Site and press [Enter]. You’ll see the following output from the command:
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

  Web Site Number = 1
  Web Site Description = Default Web Site
    Hostname =
    Port = 80
    IP Address =

By giving the script the Site name, you’ll be able to locate it in the metabase.

Importing and exporting
The most common use for the MetaEdit tool is to import and export the values to different servers. Using MetaEdit in this fashion can be a good way to quickly set up new Web sites. If you create a lot of new sites, or move sites from one server to another, you’ll use the import/export commands quite a bit. An exported metabase is also your best bet to recover from a disaster scenario.

To export all of your Web and FTP sites, select Export from the metabase menu. This, however, doesn’t back up your global settings, just the sites themselves. This is also a fairly intensive process, and it may cause the metabase to become locked during the operation. Because MetaEdit can lock the metabase, you might want to do this when the server is at a low usage level.

Exporting the entire metabase is a two-part process—one for the LM tree, and one for the Schema tree. Select the LM node and select Export Text file from the metabase menu. Doing so will export only the LM tree, so you must repeat the process for the Schema tree. If you want a particular site, or tree, you can repeat the same process, but initially select only the appropriate tree.

To reimport the text file, you can e-mail the file to someone at a different location or to a different machine to do a recovery. When you import, you’re given two options: (1) to restore from the original location included in the export file, or (2) to restore under the node that is currently selected. If you restore to the original location, all of your existing settings will be overwritten. If you select a different locale, then you can look at any differences from your current setting and move only the options that you want.

Get to it
As you administer IIS, you’ll find that using MetaEdit will save you lots of time. It can be a dangerous tool, but it’s also powerful. Take some time getting used to the tool on a test system, and before you know it, you’ll be a MetaEdit master.


Editor's Picks

Free Newsletters, In your Inbox