Functions/Client/Out-CdsClient.ps1
<#
.SYNOPSIS Initialize CrmserviceClient instance from connection. #> function Out-CdsClient { [CmdletBinding()] [OutputType("Microsoft.Xrm.Tooling.Connector.CrmServiceClient")] param ( [Parameter(Mandatory = $true, ValueFromPipeline)] [System.Xml.XmlElement] $Connection ) begin { $StopWatch = [System.Diagnostics.Stopwatch]::StartNew(); Trace-CdsFunction -Name $MyInvocation.MyCommand.Name -Stage Start -Parameters ($MyInvocation.MyCommand.Parameters); } process { $xrmClient = New-CdsClient -ConnectionString $Connection.ConnectionString; $xrmClient; } end { $StopWatch.Stop(); Trace-CdsFunction -Name $MyInvocation.MyCommand.Name -Stage Stop -StopWatch $StopWatch; } } Export-ModuleMember -Function Out-CdsClient -Alias *; |