functions/device/Get-PSCUCMPhone.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
function Get-PSCUCMPhone { <# .SYNOPSIS Get a single phone in CUCM .DESCRIPTION Get a single phone in CUCM based upon the Directory Number .PARAMETER DN Directory Number to look up. .PARAMETER EnableException Replaces user friendly yellow warnings with bloody red exceptions of doom! Use this if you want the function to throw terminating errors you want to catch. .EXAMPLE Get-PSCUCMPhone -DN 1001 Returns the phone with DN 1001. #> [CmdletBinding()] param ( [Parameter(Mandatory = $true)] [string] $DN, [switch] $EnableException ) $phoneNameByDNSplat = @{ DN = $DN EnableException = $EnableException } $phoneName = Get-PSCUCMPhoneName @phoneNameByDNSplat | Select-Xml -XPath '//name' | Select-Object -ExpandProperty node | Select-Object -ExpandProperty '#text' $CucmAxlSplat = @{ 'entity' = 'getPhone' 'parameters' = @{ 'name' = $phoneName } } Invoke-PSCUCMAxlQuery @CucmAxlSplat | Select-Xml -XPath '//phone' | Select-Object -ExpandProperty node } |