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.
Shinva, thank you very much for writing this script! You've saved me so much time with this!
Brilliant! Thank you!
UNC password issues were still there, but after I cleaned those up. Bingo! Thanks again!
This process is not working for me because after I followed the process, I am getting an error: "Error Parsing the XML file. Reason: A name was started with an invalid character."
I am going from a windows 2003 to a windows 2008 server running IIS 6
DID NOT WORK. I think all those comements are crap.
The migration from old to new worked great, however, I'm still unable to start IIS. I removed the UNC password as suggested below (I commented out the entire custom section for the UNCpassword), but I'm still not gettin IIS to start.