IIS Metabase Reference

FDN » IIS » IIS Metabase Reference

IIS Metabase Reference

The IIS metabase is a hierarchical database that stores configuration settings for IIS. In IIS 5.0, the metabase is stored in a binary file at C:\WINNT\System32\inetsrv\MetaBase.bin.

Metabase Structure

The metabase is organized as a tree with keys (nodes) and properties (values). The root is /LM (Local Machine).

/LM
  /W3SVC                        (Web service)
    /1                           (Site 1 = Default Web Site)
      /Root                      (Home directory)
        /docs                    (Virtual directory)
    /2                           (Site 2)
  /MSFTPSVC                     (FTP service)
  /SMTPSVC                      (SMTP service)

Common Metabase Properties

Property IDNameDescription
1002ServerCommentSite description shown in ISM
1015ServerBindingsIP:Port:Host header bindings
1016SecureBindingsSSL bindings
3001PathPhysical path of virtual directory
6005AccessFlagsRead, Write, Execute, Script permissions
6009AppRootApplication root path
6032AppFriendlyNameApplication display name
2000LogTypeLogging format (W3C, NCSA, IIS)

Scripting the Metabase with ADSI

' Read metabase properties using ADSI
Set objSite = GetObject("IIS://localhost/W3SVC/1")
WScript.Echo "Site Name: " & objSite.ServerComment
WScript.Echo "Bindings: " & objSite.ServerBindings(0)
WScript.Echo "State: " & objSite.ServerState
' ServerState: 2 = Started, 4 = Stopped, 6 = Paused

' Enumerate virtual directories
Set objRoot = GetObject("IIS://localhost/W3SVC/1/Root")
For Each objChild In objRoot
    WScript.Echo objChild.Name & " -> " & objChild.Path
Next

Backup and Restore

' Backup the metabase
Set objComputer = GetObject("IIS://localhost")
objComputer.Backup "PreChangeBackup", 1, 0
WScript.Echo "Metabase backed up."

' Restore from backup
' objComputer.Restore "PreChangeBackup", 1, 0

Metabase Explorer

The IIS Resource Kit includes Metabase Explorer (metaedit.exe), a GUI tool for browsing and editing the metabase directly. Use with caution: incorrect changes can break IIS.

« Developer Network ‹ ISAPI Extensions Guide