Create a gist now

Instantly share code, notes, and snippets.

@RIKIKU /ImportCRMOrgs.ps1 Secret
Last active Jun 20, 2017

What would you like to do?
$orgs = Import-Clixml "C:\CRMOrgs.xml" #Put the Literal Path to your Orgs Path here
$SQLServerName = "Example\exampleinstance" # The SQLServername\Instance name of the new server goes here
$SRSurl = "http://Example/reportserver" # reporting services URL of the new server goes here.
Add-PSSnapin Microsoft.crm.powershell
$jobs = @()
foreach($org in $orgs)
$jobs += Import-CrmOrganization -SqlServerName $SQLServerName -SrsUrl $SRSurl -DatabaseName $($org.DatabaseName) -DisplayName $($org.FriendlyName) -Name $($org.UniqueName) -UserMappingMethod ByAccount
Write-Output $($org.DatabaseName)
$jobs.GetEnumerator() | Get-CrmOperationStatus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment