you're reading...
Microsoft Dynamics CRM, PowerShell

Import Dynamics CRM Organisation using PowerShell and a User Mapping File

The following PowerShell script can be used to import a CRM 2011 organisation using PowerShell and a User Mapping File to map the required users only. We use this command when we restore production SQL backups to our development servers in order to change the user and administrator accounts that are used (different to production).

The PowerShell command is…

Import-CrmOrganization -SqlServerName “SQL Server Name” -DatabaseName “CRM Database Name” -SrsUrl “SQL Server Report Server URL” -DisplayName “CRM Organisation Name” -Name “CRM Organisation Name” -UserMappingMethod ByMappingXml -UserMappingXml “Path to UserMappingFile.xml”

…and an example…

Import-CrmOrganization -SqlServerName SQLSRV01 -DatabaseName DEV_CRM -SrsUrl http://SQLSERVER01/Reports -DisplayName DEV -Name DEV -UserMappingMethod ByMappingXml -UserMappingXml “C:\user_mapping.xml”

User Mapping File
Note: The User Mapping File can also be created through CRM Deployment Manager without importing the Organisation. To do so, in Deployment Manager select Import Organisation and when you get to “Select Method for Mapping Users”, select “Select Custom Mapping Options”, then select “Generate a new mapping file”. Select the location to save the file and then map the appropriate users to map – this does not import the Organisation

<DomainMapping old=“PRODUCTION” new=“DEVELOPMENT” />
<UserMapping old=“PRODUCTION\Administrator” new=“DEVELOPMENT\Administrator” />
<UserMapping old=“PRODUCTION\leejghardy” new=“DEVELOPMENT\leejghardy”/>

Once you run the PowerShell script with this mapping file, you should get a GUID as an output and in CRM Deployment manager you should see the new Organisation in Pending state – this will change to Enabled once the import is complete and the Organisation is ready to use


No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: