Functions/Solutions/Components/Copy-CdsSolutionComponents.ps1
<#
.SYNOPSIS Copy Solution Components #> function Copy-CdsSolutionComponents { [CmdletBinding()] param ( [Parameter(Mandatory=$false, ValueFromPipeline)] [Microsoft.Xrm.Tooling.Connector.CrmServiceClient] $CdsClient = $Global:CdsClient, [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $SourceSolutionUniqueName, [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $TargetSolutionUniqueName ) begin { $StopWatch = [System.Diagnostics.Stopwatch]::StartNew(); Trace-CdsFunction -Name $MyInvocation.MyCommand.Name -Stage Start -Parameters ($MyInvocation.MyCommand.Parameters); } process { $sourceComponents = $CdsClient | Get-CdsSolutionComponents -SolutionUniqueName $SourceSolutionUniqueName; ForEach-ObjectWithProgress -Collection $sourceComponents -OperationName "Solution components copy from $SourceSolutionUniqueName to $TargetSolutionUniqueName" -ScriptBlock { param($component) Add-CdsSolutionComponent -CdsClient $CdsClient -SolutionUniqueName $TargetSolutionUniqueName -ComponentId $component.objectid -ComponentType $component.componenttype_Value.Value; } } end { $StopWatch.Stop(); Trace-CdsFunction -Name $MyInvocation.MyCommand.Name -Stage Stop -StopWatch $StopWatch; } } Export-ModuleMember -Function Copy-CdsSolutionComponents -Alias *; |