functions/line/Find-PSCUCMLine.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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
function Find-PSCUCMLine { <# .SYNOPSIS Find lines within CUCM .DESCRIPTION Find lines within CUCM that match the criteria .PARAMETER Pattern Pattern to search .PARAMETER Description Description to search .PARAMETER Usage Usage to search (Your guess is as good as mine...) .PARAMETER RoutePartitionName RoutePartitionName to search .PARAMETER skip Number of lines to skip. .PARAMETER first Number of lines to return. .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 Find-PSCUCMLine -Line % Finds all lines within CUCM .NOTES Uses SQL Wildcards. So % #> [CmdletBinding()] param ( [string] $Pattern, [string] $Description, [string] $Usage, [string] $RoutePartitionName, [int] $skip, [int] $first, [switch] $EnableException ) $CucmAxlSplat = @{ Entity = 'listLine' Parameters = @{ searchCriteria = @{} returnedTags = @{ pattern = '' description = '' usage = '' routePartitionName = '' aarNeighborhoodName = '' aarDestinationMask = '' aarKeepCallHistory = '' aarVoiceMailEnabled = '' callPickupGroupName = '' autoAnswer = '' networkHoldMohAudioSourceId = '' userHoldMohAudioSourceId = '' alertingName = '' asciiAlertingName = '' presenceGroupName = '' shareLineAppearanceCssName = '' voiceMailProfileName = '' patternPrecedence = '' releaseClause = '' hrDuration = '' hrInterval = '' cfaCssPolicy = '' defaultActivatedDeviceName = '' parkMonForwardNoRetrieveDn = '' parkMonForwardNoRetrieveIntDn = '' parkMonForwardNoRetrieveVmEnabled = '' parkMonForwardNoRetrieveIntVmEnabled = '' parkMonForwardNoRetrieveCssName = '' parkMonForwardNoRetrieveIntCssName = '' parkMonReversionTimer = '' partyEntranceTone = '' allowCtiControlFlag = '' rejectAnonymousCall = '' confidentialAccess = @{ confidentialAccessMode = '' confidentialAccessLevel = '' } externalCallControlProfile = '' enterpriseAltNum = @{ numMask = '' isUrgent = '' addLocalRoutePartition = '' routePartition = '' advertiseGloballyIls = '' } e164AltNum = @{ numMask = '' isUrgent = '' addLocalRoutePartition = '' routePartition = '' advertiseGloballyIls = '' } pstnFailover = '' associatedDevices = @{ device = '' } } } EnableException = $EnableException } if(![string]::IsNullOrEmpty($Pattern)) { $CucmAxlSplat.Parameters.searchCriteria.Add('pattern', $pattern) } if(![string]::IsNullOrEmpty($description)) { $CucmAxlSplat.Parameters.searchCriteria.Add('description', $description) } if(![string]::IsNullOrEmpty($usage)) { $CucmAxlSplat.Parameters.searchCriteria.Add('usage', $usage) } if(![string]::IsNullOrEmpty($routePartitionName)) { $CucmAxlSplat.Parameters.searchCriteria.Add('routePartitionName', $routePartitionName) } if($skip) { $CucmAxlSplat.Parameters.Add('skip', $skip) } if($first) { $CucmAxlSplat.Parameters.Add('first', $first) } Invoke-PSCUCMAxlQuery @CucmAxlSplat | Select-Xml -XPath '//line' | Select-Object -ExpandProperty node } |