MOSS MVP

I've moved my blog to http://blog.falchionconsulting.com!. Please update your links. This blog is no longer in use--you can find all posts and comments at my new blog; I will no longer be posting to this site and comments have been disabled.

Thursday, August 9, 2007

Migrate Profile Data from SPS 2003 to MOSS 2007

As we were doing our upgrade we realized early on that we did not want to keep the SSP as it was migrated during the upgrade process. The upgraded version just locked us into to many things that we didn't like. As a result we decided that we would delete the upgraded SSP and create a new one. This meant that I had to find a way to get any custom profile properties that were created in SPS 2003 as well as any user provided data over to MOSS. In my particular situation I didn't have to worry about creating new profiles - we were going to set up a profile import, let the import occur, and then adjust the profiles - so the tool I created uses a map file to figure out which properties to create and which data to copy over.

The tool first creates any missing properties and then loops through all users in the old system and sets the data in the new system. One of my requirements was to be able to get the SPS 2003 profile data without relying on the SPS 2003 server to still be running - as a result I chose to grab the data directly from the database (note that I am currently not handling Multi-Value properties as my system didn't have any that I needed to migrate so I chose to ignore them - though I can handle setting multi-value properties, just not reading them). In order to pull this off I needed two STSADM commands - one to generate the xml map file, gl-gen2003to2007profilepropertymap, and the other, gl-migrate2003profilesto2007, to consume that map file and do the actual migration. I discuss each of them below.

1. gl-gen2003to2007profilepropertymap

Before you can use the migration command you have to generate a mapping file. In order to assist with this I created this command. The resultant xml file contains reference nodes showing all the current MOSS 2007 properties and their settings. It also shows all the properties from your 2003 database. If the tool can find a matching column in MOSS then it will add minimal details. If it cannot find a match then it will add all the attributes that are required for creating a new column in MOSS. The syntax of the command is as follows:

C:\>stsadm -help gl-gen2003to2007profilepropertymap

stsadm -o gl-gen2003to2007profilepropertymap

Generates a mapping file to map SharePoint 2003 profile data into a SharePoint 2007 SSP.

Parameters:
        -profdb2003 <database server containing the 2003 profile database>
        -profdbname2003 <2003 profile database name>
        -sspname <name of the 2007 SSP>
        -output <mapping file to generate>

Here’s an example of how to create a profile map that you can then manipulate:

stsadm –o gl-gen2003to2007profilepropertymap –profdb2003 "dbserver" -profdbname2003 "dbname" -sspname "SSP1" -output "c:\propertymap.xml"

After running this command you'll get an xml file which you can then manually modify to meet your needs. The structure of the xml file is fairly simple:

   1: <ProfileMap>
   2:     <Property PropertyID="16" PropertyName="AboutMe" IsMultiValue="False" Length="3600" propertyName-2007="AboutMe" />
   3:     <Property PropertyID="30" PropertyName="CollegeMajor" IsMultiValue="False" Length="255" DisplayName="College Major" DataTypeName="string" IsAlias="False" IsEditable="True" IsPrivate="False" IsVisibleOnEditor="True" IsVisibleOnViewer="False" propertyName-2007="" />
   4: <ProfileMap> 

The above is a trimmed example but from it you can see one property that existed in both SPS 2003 and MOSS 2007 (AboutMe) and another which only existed in SPS 2003 (CollegeMajor). The "propertyName-2007" attribute is the most critical as it is what tells the migration tool where to store the data. If this is empty then it will attempt to create the property (after verifying that it doesn't already exist).

2. gl-migrate2003profilesto2007

Once you've created your property map you are ready to do the actual migration. As described above, this command takes the property map xml file as an input and loops through the properties, creating any missing properties and then loops through each profile in the 2003 database and setting the property values in MOSS. You can assign more than one 2003 property to a single 2007 property if that 2007 property is a multi-value property. The syntax of the command is as follows:

C:\>stsadm -help gl-migrate2003profilesto2007

stsadm -o gl-migrate2003profilesto2007

Migrates profile data and columns from a SharePoint 2003 profile database to SharePoint 2007

Parameters:
        -profdb2003 <database server containing the 2003 profile database>
        -profdbname2003 <2003 profile database name>
        -sspname <name of the 2007 SSP>
        -input <mapping file>

Here’s an example of how to migrate data using the mapping file:

stsadm –o gl-migrate2003profilesto2007 –profdb2003 "dbserver" -profdbname2003 "dbname" -sspname "SSP1" -input "c:\propertymap.xml"

5 comments:

srikanth said...

Hi Gary,

When i tried migrating profiles from sps2003 to 2007 using gl-migrate2003profilesto2007 command i am getting the following error

"String was not recognized as a valid Boolean"

I could not figure out the reason.can you please help me.
I am following the same steps as described by you.

Thanks
srikanth

Gary Lapointe said...

Sorry for my delay in getting to you - it's been a busy month. Try removing all of the mapped fields and add them back in one at a time so that you can narrow it down to the specific field that is causing you issues. Most likely the mapping is trying to put non-boolean data into a boolean column.

Anonymous said...

Thanks much for this great tool!

I assume for the actual migration of data section, in your example/sample code you meant to use gl-migrate2003profilesto2007 instead of gl-gen2003to2007profilepropertymap?

Thanks

Gary Lapointe said...

Oops - yes, that would be a typo - gotta love copy and paste :)

Frank said...

Hi,

I need a extension that will update security for an entire site WSS site collection. The extension should (ideally) have swithced to remove certain groups as well.

For example:
stsadm -o securityupdate -sitename [http://intranet] -remove [security group name (restricted read)]

The above mentioned extension should then loop through all sites and remove all users with the restricted read permission from all sites.

The security updates (for an entire site collection) is something that I require more and more often.

Looking forward to your comment.

Regards,
Francois P.