Public/Support/VoiceConfig/Get-TeamsCPP.ps1
# Module: TeamsFunctions # Function: VoiceConfig # Author: David Eberhardt # Updated: 09-JUL-2022 # Status: Live function Get-TeamsCPP { <# .SYNOPSIS Lists all Teams Call Park Policies by Name .DESCRIPTION To quickly find Teams Call Park Policies to assign, an Alias-Function to Get-CsTeamsCallParkPolicy .PARAMETER Identity String. Name or part of the Teams Call Park Policy. Can be omitted to list Names of all Policies (including "Global"). If provided without a '*' in the name, an exact match is sought. .EXAMPLE Get-TeamsCPP Returns the Object for all Teams Call Park Policies (including "Global") Behaviour like: Get-CsTeamsCallParkPolicy, showing only a few Parameters .EXAMPLE Get-TeamsCPP -Identity ServiceDesk Returns the Object for the Teams Call Park Policy "ServiceDesk" (provided it exists). Behaviour like: Get-CsTeamsCallParkPolicy -Identity "ServiceDesk" .EXAMPLE Get-TeamsCPP -Identity *Desk Lists Call Park Policies with "Desk" in the Name Behaviour like: Get-CsTeamsCallParkPolicy -Filter "*Desk*" .NOTES This script is indulging the lazy admin. It behaves like Get-CsTeamsCallParkPolicy with a twist: If more than three results are found, a reduced set of Parameters are shown for better visibility: Get-CsTeamsCallParkPolicy | Select-Object Identity, Description, AllowCallPark .INPUTS None System.String .OUTPUTS System.Object .COMPONENT SupportingFunction VoiceConfiguration .FUNCTIONALITY Queries Call Park Policies by Name .LINK https://github.com/DEberhardt/TeamsFunctions/tree/main/docs/Get-TeamsCPP.md .LINK https://github.com/DEberhardt/TeamsFunctions/tree/main/docs/about_VoiceConfiguration.md .LINK https://github.com/DEberhardt/TeamsFunctions/tree/main/docs/about_Supporting_Functions.md .LINK https://github.com/DEberhardt/TeamsFunctions/tree/main/docs/ #> [CmdletBinding()] param ( [Parameter(Position = 0, ValueFromPipeline, ValueFromPipelineByPropertyName, HelpMessage = 'Name of the Call Park Policy')] [ArgumentCompleter({ &$global:TfAcSbTeamsCallParkPolicy })] [string]$Identity ) begin { Show-FunctionStatus -Level Live Write-Verbose -Message "[BEGIN ] $($MyInvocation.MyCommand)" # Asserting MicrosoftTeams Connection if ( -not (Assert-MicrosoftTeamsConnection) ) { break } } #begin process { Write-Verbose -Message "[PROCESS] $($MyInvocation.MyCommand)" if ($PSBoundParameters.ContainsKey('Identity')) { Write-Verbose -Message "Finding Teams Call Park Policy with Identity '$Identity'" if ($Identity -match [regex]::Escape('*')) { $Filtered = Get-CsTeamsCallParkPolicy -Filter "*$Identity*" -ErrorAction $ErrorActionPreference } else { $Filtered = Get-CsTeamsCallParkPolicy -Identity "$Identity" -ErrorAction $ErrorActionPreference } } else { Write-Verbose -Message 'Finding Teams Call Park Policy Names' $Filtered = Get-CsTeamsCallParkPolicy -ErrorAction $ErrorActionPreference #| Where-Object Identity -NE 'Global' } if ( $Filtered.Count -gt 3) { $Filtered = $Filtered | Select-Object Identity, Description, AllowCallPark } return $Filtered | Sort-Object Identity } #process end { Write-Verbose -Message "[END ] $($MyInvocation.MyCommand)" } #end } # Get-TeamsCPP |