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