IIS 6.0 Recovering websites from a stale metabase.xml

IIS 6.0 Recovering websites from a stale metabase.xml

Rate This
  • Comments 18

     The metabase is a repository for most IIS configuration settings. It resides as a plaintext XML file metabase.xml in the systemroot\System32\Inetsrv folder. All the websites and their corresponding settings are stored in this file.
     The problem with this file is that even though it is plain text xml we cannot copy it over from one server to another to get the website settings to the new server. Also if you reinstall IIS you cannot use an old metabase.xml backup to restore the websites and settings. The reason? If you open up metabase.xml you will find tags in it called "AdminACL". This is the Access Control List that is encrypted using the current "Machine Keys" (C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys) on the server. So if you reinstall IIS or move the metabase.xml to another server IIS will not be able to decrypt the access control list and hence will not be able to load the metabase. So you end up in a situation where the IIS service will not start.
     So what do we do when we have a server crash and end up reinstalling IIS? You now have a new set of Machine Keys and are left with a stale metabase.xml that cannot be used. Even tools like MetabaseExplorer and MetaEdit will not allow you to load or import the stale metabase.
     What we can do is play around with the current working metabase.xml file (remember it is still plaintext) and copy paste the necessary tags from the old stale metabase.xml and get "almost all" of the settings back. But it is a tedious work and consider scenarios where the IIS server is hosting multiple sites.
     I was once in a similar situation where I had to restore 883 websites and 182 FTP sites from a backup metabase.xml file onto a reinstalled IIS instance.
     So I have written a small console app that would do the same. It copies websites/ftp sites and web service extensions from any metabase.xml into the current metabase.xml

USAGE : It is a console application so unzip the attached MetaBaseImport.zip in a folder. Copy the current working metabase.xml and the backed up metabase.xml into the same folder. Then run

Metabaseimport <current_metabase.xml> <old_metabase.xml>

This will generate a file called NewMetaBase.xml with the Server Settings of the current working metabase.xml and the websites/ftp sites from the old metabase.xml. Stop IIS services. Replace the metabase in the inetsrv folder with the NewMetaBase.xml and start the IIS services. You will have all the old sites.

Note: All secure entries like IUSR/IWAM/UNC UserName and Passwords. In case you had custom entries you will have to manually add them again.


While this application is not perfect it manages to do most of the dirty stuff. Let me know if you find it useful.


Bookmark and Share
Attachment: MetaBaseImport.zip
Leave a Comment
  • Please add 1 and 4 and type the answer here:
  • Post
  • Great tool!! Awesome work. Saved me lots of time restoring a webserver.

  • Great tool. I have one question. Can we use this tool also for virtual directories.

  • Nice...

  • Cool!

  • Excellent! Just what I needed!

  • Thanks heaps. Smooth transition.

  • You are the MAN!!!. I have searched the internet all over the place and I could not find anything like this. Thank you so much for giving so much value to the world.

  • Thanks for the tool!  One small issue is that if you have 2nd level virtual directories, it misses the entry for the IIsConfigObject that has the parent folder name.  This causes any 2nd level virtuals to not be setup.

  • You know... this thing just made my day....

  • You ARE AWESOME... This file saved my day..

    Thanks a LOT.

  • Thanks, expected someone would have been in the same boat!

    In my case, I was left with a couple of UNC password entries flagged in the event log that were still preventing IISAdmin startup.  Removed them and it started and loaded all the sites!

    Thanks for this great tool!

  • Just wanna say thanks like the rest, just made 6 identical servers in 2 min... Super Nice...

  • Thanks! After a good couple of hours battling - your tool was the trick i needed to recover my exchange. THANKS!!!

  • Thanks a lot for sharing this great tool!!!

  • I was ready to start picking apart the old metabase file and you saved me so much time! Thanks!

Page 1 of 2 (18 items) 12