in IIS, Windows

How to migrate multiple sites from IIS 6 to IIS 7

This is a quick guide on how to migrate all sites from IIS 6 to IIS 7. You can probably use the same commands to move sites from one IIS 7 to another.

Everything will be migrated, including application pools, virtual directories, SSL certficiates etc.

1. Download and install Web Deployment Tool on both source and destination servers: http://www.iis.net/download/webdeploy

2. Backup the IIS configuration on the destination server

cmd
cd C:\Program Files\IIS\Microsoft Web Deploy V2
%windir%\system32\inetsrv\appcmd add backup “PreWebDeploy”

3. Export the configuration from the source server to a zip package

cmd
cd C:\Program Files\IIS\Microsoft Web Deploy V2
msdeploy -verb:sync -source:metakey=lm/w3svc -disableLink:contentExtension -dest:package=C:\Temp\Sites.zip,encryptPassword=P4ssword > C:\Temp\WebDeploySource.log

You can choose any password in the “encryptPassword” variable. Using the “-disableLink:contentExtension” will only move configuration and when you have a lot of data it’s probably the way to go.

4. Simulate import on the destination server (optional)

You can use msdeploy to see what would happen if you imported the package from the source server. No changes will be made to the IIS configuration and you can see what would happen in the log file

cmd
cd C:\Program Files\IIS\Microsoft Web Deploy V2
msdeploy -verb:sync -source:package=c:\Temp\Sites.zip,encryptPassword=P4ssword -disableLink:contentExtension -dest:metakey=lm/w3svc -whatif > C:\temp\WebDeployWhatIf.log

5. Import sites to the destination server

cmd
cd C:\Program Files\IIS\Microsoft Web Deploy V2
msdeploy -verb:sync -source:package=c:\Temp\Sites.zip,encryptPassword=P4ssword -disableLink:contentExtension -dest:metakey=lm/w3svc > C:\temp\WebDeployDestination.log