As part of the upgrade I was working on we wanted to move site collections from the upgraded location to a new location on a different web application. This can be done really easily using the backup and restore built-in commands in conjunction with the deletesite command. But I wanted to make this work in one step with the upgrade so I decided to extend the upgrade2 command to enable the moving of sites. I figured though, if I'm going to write the code to do this why not abstract the ability out into a separate command all it's own. The result is a new command called gl-movesite. The nice thing about this is that it ends up doing what you would think the new renamesite command (part of SP1) would do - if you've tried to use this most likely you've noticed that it only works with host header mapped sites so the majority of us that aren't using host header mapped sites the command is pretty useless. The code to do this is really simple - in fact I'm not doing anything unique - I'm just calling out to the built-in stsadm commands - I suppose I could have written the code to use the API directly but this was easier and accomplished the same thing and I was able to put it together in about 10 minutes.
The syntax of the command can be seen below:
C:\>stsadm -help gl-movesite stsadm -o gl-movesite Moves a site collection (wraps the backup, deletesite, and restore operations into one operation) Parameters: -url <url of site collection to move> -moveto <url of new target path>Here's an example of how to move a site collection: