Migrating a site between domains

So I realize that this article is about two years too late, but the question still comes up from time to time, so I figured that I might as well post it.

Situation:  You find yourself in a quandary without the use of a third party tool from AvePoint, Metalogix, Quest, Tzunami and your organization just merged with another… and you’ve got site data that you need to move.  Sure, sounds easy, but it’s a pretty rough job that requires planning.

Courses of action that you might proceed down:

  • First option that comes to mind would be to perform a content migration through the attaching of content databases onto a dev server in a separate web application on the destination domain, and proceeding to restore database schema permissions to the content databases so that the farm can access the data properly.  This works pretty well with the exception that if you have sites that overlap sites that already exist when you’re beginning your movement of sites from the dev environment to the production environment.  Additionally, all user permissions need to be reassigned – so you end up running through stsadm in a batch script fashion.
  • Second option that comes to mind is to use Gary Lapointe’s export and import files stsadm extension.  These extensions go above and beyond what the out of the box stsadm tool provides and fulfills several other purposes outside the scope of this article. Using these extensions for exporting document libraries and lists, you’re able to perform a content deployment method without having to write any of your own code.  Additionally, there are extensions that allow for exporting a list or document libraries schema so that you’re able to recreate site columns and content types within the destination list.  The only potential issue that would arise would be recreating or migrating all site permissions.
  • Third option with potential for small organizations – save site as template with content.  Unfortunately this can only grow so big before it becomes unwieldy and templates stop working.
  • The fourth option, which to me seems to be the easiest as long as you’re dealing with a fairly vanilla SharePoint installation that doesn’t have customized site definitions, is to follow the approach of using standard stsadm tools and a bit of elegant batch file hacking.

c:%12hive%bin> stsadm -o export –url http://<webApp>/sites/<siteCollection>/<siteName&gt; –filename    <nameOfFile>.cmp -includeusersecurity -versions 4 -nofilecompression

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

This will take the site, keep all versions and the sites’ security as well as dump the files without compressing into a cab – for extremely large sites, cabs don’t work 😦

Next, you’d go in and create the shell on the new site collection…

c:%12hive%bin> stsadm -o createsite –url http://<webApp>/sites/<siteCollection&gt; –ownerlogin  <domain><user> -owneremail <emailAddress>

or if creating a site…

c:%12hive%bin> stsadm –o createweb –url http://<webApp>/sites/<siteCollection>/<site&gt;

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

Then you’d import the new site to that site (DO NOT go to the previously created site and choose a template).

c:%12hive%bin> stsadm -o import –url http://<webApp>/sites/<siteCollection> –filename <nameOfFile>.cmp -includeusersecurity -updateversions 1 -nofilecompression

or if creating within the context of a site (rather than site collection)

c:%12hive%bin> stsadm –o import –url http://<webApp>/sites/<siteCollection>/<site> –filename <nameOfFile>.cmp –includeusersecurity –updateversions 1 -nofilecompression

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

The details of import and export are available at:

http://technet.microsoft.com/en-us/library/cc262465.aspx

After you’ve done that, you’ll probably want to add yourself as the owner to that site collection (if you’re importing into a site collection, else you can skip this)…

c:%12hive%bin> stsadm -o siteowner –url http://<webApp>/sites/<siteCollection> –ownerlogin <domain><user>

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

The details of site owner are available at:

http://technet.microsoft.com/en-us/library/cc262637.aspx

Next, you’ll want to ensure that the security groups are how you want them – moving them from one site collection to another through a site isn’t always as pretty as you might hope.  Sometimes it’s best to go in and re-create them in the new site collection rather than bringing over what was old, using them as a reference before toasting them.

Lastly, you’ll need to migrate the user permissions from domain A to domain B.

To do this, again, pretty trivial, just a little stsadm’ing.  I’d recommend creating a spreadsheet in Excel and then exporting it to a text file to run as a batch so that you end up with something like this:

c:%12hive%bin>stsadm -o migrateuser -oldlogin <domainA><user1> -newlogin <domainB>TempUser –ignoresidhistory

c:%12hive%bin>stsadm –o migrateuser –oldlogin <domainB>TempUser -newlogin <domainB><user1>

This method takes the user, reassigns them to a temporary user and then the TempUser is migrated to the user account in the new domain.  This is not always necessary, however I’ve come across a few instances where using a TempUser is recommended to ensure that the migration occurs properly.

Reference: http://technet.microsoft.com/en-us/library/cc262141.aspx

If you’re getting stuck, and need to don’t mind looking inside your database to see what’s going on, check out Todd Klindt’s article “A few notes abouT STSADM –o migratuser”.

Happy Migrating!

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

STSADM Extensions for WCM and beyond…

Further diving into the realm of STSADM extensions, I came across Andrew Connell‘s stsadm extensions for MOSS Web Content Management, providing the ability to quickly generate site columns, generate site content types or publish all items that are currently in queue of a web content site.

If you’re interested in going above and beyond what is already out there from Andrew, Gary and others, I’d recommend reading up Tony Bierman’s blog entry on extending the stsadm command set using the ISPStsadmCommand Interface.

STSADM Extensions… explored

First off, for those of you not familiar with Gary LaPointe’s STSADM Extensions, I would recommend checking out his blog over at http://stsadm.blogspot.com and investigate what he’s got to offer.

For those of you that are familiar with stsadm for WSS and MOSS then you’re familiar with the likes of Ben Curry‘s Microsoft SharePoint Products and Technologies Administrator’s Pocket Consultant which provides a thorough reference of the STSADM command set.  Sometimes the command set can be tedious, at other times, fairly trivial, but more than likely scripting something with it is somewhat tedious.

Enter Gary LaPointe’s stsadm extensions which take stsadm to the next level.  Gary’s extensions go above and beyond where arduous scripting would more than likely lead you, allowing you to quickly step out on administrative tasks without having to get stuck in the world of windows script host.

My current favorite extension would have to be the gl-backupsites extension which allows for the quick and easy backup of all site collections within a web application or farm.  For those of you that have had to write scripts to do this in the past, you’ll find that this is far simpler.

Thanks for your contribution to the community Gary!