Private/Set-ADCMonitorToGSLBService.ps1
function Set-ADCMonitorToGSLBService { <# .SYNOPSIS Sets (Binds) a Monitor to a Load Balancing GSLB Service. .DESCRIPTION Sets (Binds) a Monitor to a Load Balancing GSLB Service. .PARAMETER Session The Citrix ADC Session to execute the function against. .PARAMETER GSLBServiceName The GSLB Load Balancing Service Name. .PARAMETER MonitorName The Monitor to bind to the GSLB 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-ADCMonitorToGSLBService -ServiceName "gslb_svc_citrix_storefront_443" -MonitorName "gslb_mon_citrix_storefront_443" -Verbose #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Medium')] Param ( $Session = $script:session, [parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName)] [string[]]$GSLBServiceName = (Read-Host -Prompt 'Enter GSLB Service Name'), [string[]]$MonitorName = (Read-Host -Prompt 'Enter Monitor Name') ) begin { $PayLoad = @{ servicename = "$GSLBServiceName" monitor_name = "$MonitorName" } } process { try { if ($Force -or $PSCmdlet.ShouldProcess("ShouldProcess?")) { Invoke-ADCRestAPI -Session $Session -Method POST -Type "gslbservice_lbmonitor_binding" -Payload $PayLoad -Action Add write-verbose "Monitor ($MonitorName) bound to GSLB Service ($GSLBServiceName)" } } catch { write-verbose "Monitor ($MonitorName) could not be bound to GSLB Service ($GSLBServiceName)" } } end { } } |