functions/utility/Connect-PSCucm.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 |
function Connect-PSCucm { <# .SYNOPSIS "Connect" to CUCM Server .DESCRIPTION "Connect" to a CUCM Server using the supplied values. .PARAMETER AXLVersion AXL Version for the Server to connect to. Typically same version as CUCM itself. .PARAMETER server Server to connect to. .PARAMETER Credential Credential Object for the Application User that has the appropriate AXL permissions. .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. .PARAMETER SkipCertificateCheck Skip the check of the certificate. Needed in test environments, and environments without "valid" signed certificates. .PARAMETER PersistSettings Persist the settings beyond the current session. .EXAMPLE Connect-PSCucm -AXLVersion 11.5 -server cucm.example.com -Credential $AXLCredential It connects to CUCM Server cucm.example.com #> [CmdletBinding()] param ( [Parameter(Mandatory = $true)] [string] $AXLVersion, [Parameter(Mandatory = $true)] [string] $server, [Parameter(Mandatory = $true)] [pscredential] $Credential, [switch] $EnableException, [switch] $SkipCertificateCheck, [switch] $PersistSettings ) Set-PSFConfig -Module PSCUCM -Name Connected -Value $true Set-PSFConfig -Module PSCUCM -Name AXLVersion -Value $AXLVersion Set-PSFConfig -Module PSCUCM -Name Server -Value $Server Set-PSFConfig -Module PSCUCM -Name Credential -Value $Credential Set-PSFConfig -Module PSCUCM -Name SkipCertificateCheck -Value $SkipCertificateCheck $Global:PSDefaultParameterValues['*-PSCucm*:EnableException'] = $EnableException if ($PersistSettings) { Register-PSFConfig -FullName pscucm.axlversion Register-PSFConfig -FullName pscucm.server Register-PSFConfig -FullName pscucm.credential Register-PSFConfig -FullName pscucm.skipcertificatecheck Register-PSFConfig -FullName pscucm.connected } } |