Private/Set-ADCGSLBServiceTovServer.ps1

function Set-ADCGSLBServiceTovServer {
    <#
.SYNOPSIS
    Sets (Binds) a GSLB Service to a GSLB Virtual Server.
.DESCRIPTION
    Sets (Binds) a GSLB Service to a GSLB Virtual Server.
.PARAMETER Session
    The Citrix ADC Session to execute the function against.
.PARAMETER vServerName
    The GSLB Virtual Server Name.
.PARAMETER ServiceName
    The GSLB Service Name.
.NOTES
    Creation Date: 20/06/2018
.CHANGE CONTROL
    Name Version Date Change Detail
    David Brett 1.0 29/03/2018 Function Creation
.EXAMPLE
    Set-ADCGSLBServiceTovServer -vServerName "gslb_vsvr_citrix_storefront_london" -ServiceName "gslb_svc_vsvr_citrix_storefront_london" -Verbose
#>

    
    [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Medium')]
    Param (
        $Session = $script:session,
        [parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName)]
        [string[]]$vServerName = (Read-Host -Prompt 'Enter GSLB Virtual Server Name'),
        [string[]]$ServiceName = (Read-Host -Prompt 'Enter GSLB Service Name')
    )

    begin {
        $PayLoad = @{
            name        = "$vServerName"
            servicename = "$ServiceName"
        }
    }
   
    process {
        try {
            if ($Force -or $PSCmdlet.ShouldProcess("ShouldProcess?")) {
                Invoke-ADCRestAPI -Session $Session -Method POST -Type "gslbvserver_gslbservice_binding" -Payload $PayLoad -Action Add
                write-verbose "GSLB Service ($ServiceName) bound to GSLB vServer ($vServerName)"
            }
        }
        catch {
            write-verbose "GSLB Service ($ServiceName) could not be bound to GSLB vServer ($vServerName)"
        }
    }

    end {
    }

}