Functions/Organization/Get-CdsOrganization.ps1
<#
.SYNOPSIS Get Organization #> function Get-CdsOrganization { [CmdletBinding()] param ( [Parameter(Mandatory=$false, ValueFromPipeline)] [Microsoft.Xrm.Tooling.Connector.CrmServiceClient] $CdsClient = $Global:CdsClient, [Parameter(Mandatory = $false)] [ValidateNotNullOrEmpty()] [String[]] $Columns = @("*") ) begin { $StopWatch = [System.Diagnostics.Stopwatch]::StartNew(); Trace-CdsFunction -Name $MyInvocation.MyCommand.Name -Stage Start -Parameters ($MyInvocation.MyCommand.Parameters); } process { $query = New-CdsQueryExpression -LogicalName "organization" -Columns $Columns; $results = $CdsClient | Get-CdsMultipleRecords -Query $query; $organization = $results | Select-Object -First 1; $organization; } end { $StopWatch.Stop(); Trace-CdsFunction -Name $MyInvocation.MyCommand.Name -Stage Stop -StopWatch $StopWatch; } } Export-ModuleMember -Function Get-CdsOrganization -Alias *; |