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 ID | Name | Description |
|---|---|---|
| 1002 | ServerComment | Site description shown in ISM |
| 1015 | ServerBindings | IP:Port:Host header bindings |
| 1016 | SecureBindings | SSL bindings |
| 3001 | Path | Physical path of virtual directory |
| 6005 | AccessFlags | Read, Write, Execute, Script permissions |
| 6009 | AppRoot | Application root path |
| 6032 | AppFriendlyName | Application display name |
| 2000 | LogType | Logging 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.