RSS
Twitter
LinkedIn

 

SharePoint 2013 - Migrate/Replicate User Profile Service Application Configuration between Farms using PowerShell - Part 2

 

Following my previous Part 1 post on this subject, the following ‘Part 2' shows how you can take the "User Profile Property" settings of the existing UPSA and use them to create a matching/duplicate set of "User Profile Properties" on a new UPSA on a different/alternative SharePoint 2013 farm.

Assuming you (still) have a working User Profile Service Application (or UPSA) on an existing farm, with multiple Active Directory (AD) Sync Connections, and have "successfully completed Part 1" so also have "new matching Sync Connections" on the alternative/target farm.

 

The first step is export the User Profile Properties from the existing farm.

 

This can be achieved by establishing a connection to the UserProfileConfigManager.ProfilePropertyManager and use the GetCoreProperties method to retrieve all "CoreProperty objects" and the GetProfileTypeProperties method to retrieve "all ProfileTypeProperty objects" and finally establishing a connection to the ProfileSubtypeManager and use the GetProfileSubtype.Properties to retrieve "all profile subtype properties", before finally exporting them to a set of CSV (yes... I know I need/want to update this to XML) files using the Export-CSV cmdlet.

 

For Example:

 

 

This should create an individual “ProfilePropertyManagerCoreProperties.csv”, “UserProfilePropertyManagerUserProfileTypeProperties.csv” and “UserProfileSubTypeManagerUserProfileProperties.csv” file.

 

However, using the following cmd (from the zip below)..

 

..also creates an additional file called “CustomUPSProps.csv”.

 

 

The next step is to import the “User Profile Properties” to the alternative/target farm using the “CustomUPSProps.csv” file.


 

Some of the advantages of using this Export / Import approach is the ability to easily create the New/Additional “User Profile Properties” by simply updating the “CustomUPSProps.csv” file with additional rows of data.

*Note: Current scripts will only ever “overwrite existing settings” (excluding internal names), but could theoretically be updated to remove/delete existing properties if NOT found in the CSV file.

 

 

Please download attached zip for "full/complete .ps1" files - Example provided above is a simplified abbreviation

download  UserProfileServiceApp_PowerShell_ExportImportADProperties.zip

Usage:

  • Export Example
    .\ExportImport_UPSProfileProps.ps1 -MySiteURL http/https://<MySiteURL> -DoExport

  • Import Example
    .\ExportImport_UPSProfileProps.ps1 -MySiteURL http/https://<MySiteURL> -DoImport -ImportCSVPropFilePath <FullPathToCSVPropertyFile>

 

 

Comments

No Comments

Leave a Comment

(required)  
(optional)
(required)  
Add