Exporting IIS 7 web site settings…

Well, now that Microsoft is shipping Windows 2008 Server R2, we need to know how to (easily) migrate a site from one W2K8R2 machine to another, right?  Microsoft didn’t exactly make this an easy process because there is no built-in method in the IIS 7.0 GUI to do the site export.  So to do the export (and import on another IIS 7 box), you need to drop to a command line and run the following commands:

EXPORT site from IIS 7 (Windows 2008 R2 server)

%windir%\system32\inetsrv\AppCmd.exe LIST SITE "www.yoursitenamehere.com" /config /XML > D:\mysitesconfiguration.xml

IMPORT site into IIS 7.0 (after you have created the above export XML file…)

%windir%\system32\inetsrv\AppCmd.exe ADD SITE /IN < D:\mysitesconfiguration.xml

The last step is to create a new application pool and assign this IMPORTED site to the new application pool.

NOTES:  It is very important that you run this from a command prompt, not the “start bar box” on the Start Menu in Windows 2008 R2 Server.  Instead run the command prompt as Administrator and do this command by keying it in, or create a batch file and execute it as the administrator on that machine.

Leave a Reply

Your email address will not be published. Required fields are marked *