Migrating IIS the easy way
July 31, 2012 Leave a comment
Summer works are well under way, one of today’s tasks is to start moving a physical 2003 web server onto a fresh 2008 R2 VM. Looking at the virtual directories and config required to move it I had a feeling Microsoft would make a nifty migration tool to ease the pain… fortunately I was right 🙂
Cue the snappily named Web Deploy tool, a new version (v3) was released sometime this year which is a bonus…
The IIS team made a nice blog post that seemingly explained all the steps here…
However there are a couple of little niggles that aren’t covered in the guide and the wording at times is a bit iffy (particularly around the use of the words source and destination) so for future reference thought good to document them here.
I used the deployment package method to move the data between servers rather than the web service so that’s the method outlined below…
Step 1 – download and install MS Deploy 3.0 onto both servers
Nice simple install, downloads are here
Step 2 – back up your existing IIS6 site into a deployment package
This one works pretty much as the guide says, one thing to note is the path to the exe… C:\Program Files\IIS\Microsoft Web Deploy V3 when you first start up the cmd shell
Important: if you have SSL certificates on any of the virtual directories being migrated you’ll most likely get errors at this point stating something along the lines of “the property ‘value’ is marked as secure. An encryption password must be specified in order to deploy this property”
To do this you need to add an extra bit of code that password protects the archive files (you’ll need this later)
msdeploy -verb:sync -source:metakey=lm/w3svc/1 -dest:archivedir=c:\site1archive,encryptPassword=yourpassword
Step 3 – dry run
This will let you try the import before actually running it to make sure you haven’t missed any required Roles on the new server (in my case I needed ASP and Server Side Includes).
msdeploy -verb:sync -source:archivedir=c:\site1archive,encryptPassword=yourpassword -dest:metakey=lm/w3svc/1 -whatif > msdeploymigrate.log
Note: the IIS blog guide was written for a pre-release version of the tool so the verb migrate used in the command lines does’t actually work… substitute for sync instead as per my example above.
Note 2: remember that password from Step 2, you’ll need it now!
Step 4 – import time
If you’re happy with the results of Step 3 run the command again without the -whatif part i.e.
msdeploy -verb:sync -source:archivedir=c:\site1archive,encryptPassword=yourpassword -dest:metakey=lm/w3svc/1
Once the tool chugs through your site(s) you should see it finish successfully, along with the amount of data migrated. For good measure I restarted the w3svc and reloaded the IIS console et voila all my virtual directories were sitting there ready to go 🙂