Thursday, 12 March 2009

Restore My Sites from different domain

After a major crash, we had to reinstall Active Directory. The SharePoint server was fine, but we were planning to reinstall it on a newer server, so we did that also.

So a crash of Active Directory (with problems to restore the backup) is really what’s called a ‘worst case scenario’. Because restoring the SharePoint backup isn’t that easy. Although the restore action, using the command line tool stsadm, is easy, you will run into security problems. Because SharePoint will not actually look to domain user names, but to the underlying GUID’s. And believe me, that’s not what you like to deal with. Anyway, I had to.

Restoring the credentials for almost all sites are successfully restored, took me a while, but seems to be fine now. But we are using also My Sites, and that’s a different story. If you are familiar with the Central Administration of SharePoint, you may know that each My Site is a different site collection. I tried different ways to restore the My Sites for the users, but failed. Today, I succeeded and I like to share it with you. You may deal with this problem too when migrating from one server farm to another or from one domain to another.

I have different backup files of the My Sites (with extension .dat). In this procedure I will illustrate the steps with the user Brian Cox. So I have a brian_cox.dat file, which is the backup of his My Site (which is a site collection in SharePoint).
  1. First of all, let the user create a My Site, in my example there will be a site called: http://intranet/personal/brian_cox
  2. Login on the SharePoint server (e.g. using RDC), and open the Central Administration
  3. The first thing we need to do, to add the SharePoint administrator account to be secondary administrator at the My Site of Brian Cox.
    1. Go to: Application Management > SharePoint Site Management > Site Collection Administrators
    2. Select the correct Site Collection you need to edit, in our example http://intranet/personal/brian_cox
    3. Now you need to add the administrator account you use for SharePoint administration issues as the secondary site collection administrator. You need to this to restore and overwrite the backup data to this personal site.

    4. Press OK when done.
  4. Now you are ready to restore the backup of Brian’s My Site.
    1. Start a command prompt and run the following statement:
      stsadm –o restore –url http://intranet/personal/brian_cox -filename c:\backup\brian_cox.dat -overwrite

    2. Wait till finished.
  5. Now you need to edit the site collection administrator (remember? The restore places also the site collection administrator back from the old domain, which is not recognized by this domain (guid issues)).
    1. Go to: Application Management > SharePoint Site Management > Site Collection Administrators.
    2. Select, again, the site collection http://intranet/personal/brian_cox. You will see something like this:

    3. Replace the primary site collection administrator back to Brian Cox and press ok.
  6. Mission accomplished!

No comments: