Private/Set-ADCMonitorToService.ps1
function Set-ADCMonitorToService { <# .SYNOPSIS Sets (Binds) a Monitor to a Load Balancing Service. .DESCRIPTION Sets (Binds) a Monitor to a Load Balancing Service. .PARAMETER Session The Citrix ADC Session to execute the function against. .PARAMETER ServiceName The Load Balancing Service Name. .PARAMETER MonitorName The Monitor to bind to the Load Balancing Service. .NOTES Creation Date: 20/06/2018 .CHANGE CONTROL Name Version Date Change Detail David Brett 1.0 29/03/2018 Function Creation .EXAMPLE Set-ADCMonitorToService -ServiceName "svc_citrix_storefront_443" -MonitorName "mon_citrix_storefront_443" -Verbose #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Medium')] Param ( $Session = $script:session, [parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName)] [string[]]$ServiceName = (Read-Host -Prompt 'Enter Service Name'), [string[]]$MonitorName = (Read-Host -Prompt 'Enter Monitor Name') ) if ($Force -or $PSCmdlet.ShouldProcess("ShouldProcess?")) { $PayLoad = @{ name = "$ServiceName" monitor_name = "$MonitorName" } Invoke-ADCRestAPI -Session $Session -Method POST -Type "service_lbmonitor_binding" -Payload $PayLoad -Action Add write-verbose "Monitor ($MonitorName) bound to Service ($ServiceName)" } } |