One would think that SharePoint would prevent you from loading up a SharePoint backup on a new domain with conflicting SIDs and usernames, but it actually allows you to do so without too much grief. I recently had to do this for a client who was having serious problems with WSS search and after a few trials and tribulations with STSADM I was able to get it up and running on my test virtual machine in a matter of minutes. Obviously my test VM isn’t on the client’s domain nor does it share and SIDs with the original hosting environment.
Disclaimer!!! The notes below are just that: notes that I compiled while working on a client’s MOSS SP1 environment. This is obviously an invasive procedure so do your due diligence and take backups, use test machines, and be careful!
Login to the source server and run the following command:
Stsadm -o backup -url http://sharepoint -filename c:\sharepoint.bak
Build out the destination server and run SharePoint configuration wizard, it is ok if you’ve already created a site collection on the target server because the new site will be overwritten by the -overwrite command below.
Warning - When you build out the new server you should try to build it using the same version and install all of the same Application Templates and binaries that were on the original server.
Stsadm -o restore -url http://sharepoint -filename c:\sharepoint.bak -overwrite
If you access the site immediately after restore here’s what you’ll see (if you restored it to a new domain)
Add a user via command line because the restored site will deny all of your login attempts (unless your server is on the same domain as the original source server – *** this post describes the steps for restoring to a different domain***)
Using the central administration console, you will note that the site collection still references the original administrators which are now invalid on this new domain.
>> Central Administration >> Application Management >> Site Collection Administrators
Run the command below to change ownership:
stsadm -o siteowner -url http://sharepoint -ownerlogin sharepoint\administrator
Now if you refresh central admin console you will see the new administrator as an owner, you can change the secondary administrator at this point as well.
Run the command below to add your new administrator to the site collection with the administrator role
stsadm -o adduser -url http://localhost -userlogin administrator -useremail [email protected] -role administrator -username administrator
Run IISRESET
Warning - Do not skip this step, you won’t be able to login until you run IISReset
Now you can refresh your main site and successfully login as the administrator.
Afterwards, you can optionally run this to clean up the old lingering logins explicitly
stsadm -o migrateuser -oldlogin olddomain\SPAdmin-newlogin newdomain\SPAdmin
Restoring a SharePoint Site Collection to a new domain, 8.6 out of 10 based on 7 ratings
thanks good one…
informative.
[...] Google’s links are dead and so are my hopes for quick-and-easy migration. So far I came up with “Restoring a SharePoint Site collection to a new domain” and “Join SharePoint server to the Active Directory domain” posts, which I am trying to follow. [...]
i couldnot directly recover to the first web application via your instructions, and created another web application, created site collection list with recovery command get “access is denied” deleted the site collection and recover then. however, “exception form hresult…” error. tried to recover from central admin backup (i have both stsadmin and central admin backups.) it was ok. but whenever i want to change the ownership with your command, got “object reference not set to an instance of an object” error.
we have formatted the dc and created the same domain on another one. but the SIDs are not the same. all i want to do is running sharepoint. please help.
Great article, totally helped me out!
This is an interesting site. This is the first time I have been here, but have bookmarked you guys for the future!
This post was exactly what I needed to migrate my site to a new domain and it worked perfectly. thank you very much!
As far as I am aware, the stsadm -o migrateuser command will not run unless there is a trust in place between the two domains.
Worked 101% . . . !
Thanks . . . !
I am planning to move our internet portal (MOSS 2007) from the hosting to our internal data-center which have different domain. First I take back-up using below stsadm command:
Stsadm.exe –o backup –url http://ourportal -filename c:\backupfile.bak
Then create a new web application and site collection on the new environment and overwrite the database using the below stsadm command:
Stsadm.exe –o restore –url http://newportal/ -filename c:\ backupfile.bak –overwrite
Change site collection ownership using below command:
stsadm -o siteowner -url http://newportal/ -ownerlogin sharepoint\administrator
But when I’m trying to run below command to add administrator to the site collection with the administrator role I’m always get access denied error:
stsadm -o adduser -url http://newportal/ -userlogin administrator -useremail [email protected] -role administrator -username administrator
can some body tell me what ‘s the solution to fix this.
Hosting Environment:
Windows server 2003 Enterprise x64 SP2
SQL Server 2005
MOSS version 12.0.0.6545
New environment:
Windows server 2008 R2 Enterprise x64
SQL Server 2008 R2 x64 SP1
MOSS version 12.0.0.6608
Thanks.
