functions/device/Get-PSCUCMPhoneServices.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 |
function Get-PSCUCMPhoneServices { <# .SYNOPSIS Get the Phone Services for a phone based upon a DN. .DESCRIPTION Get the Phone Services for a phone based upon the DN of the phone. Presumes phones with services don't share the DN... Might fail spectacularly if the DN is shared... .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-PSCUCMPhoneServices -DN 1001 Gets the Phone Services for phone with DN 1001. #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns', '', Justification = "CUCM returns to us all of the services. We can't pick and choose which ones to return.")] [CmdletBinding()] param ( [Parameter(Mandatory = $true)] [string] $DN, [switch] $EnableException ) $PhoneByDNSplat = @{ DN = $DN EnableException = $EnableException } Get-PSCUCMPhone @PhoneByDNSplat | Select-Xml -XPath '//service' | Select-Object -ExpandProperty node } |