Private/Add-ADCGSLBDomainTovServer.ps1

function Add-ADCGSLBDomainTovServer {
    <#
.SYNOPSIS
    Adds a GSLB Load Balancing Service to the Citrix ADC.
.DESCRIPTION
    Adds a GSLB Load Balancing Service to the Citrix ADC.
.PARAMETER Session
    The Citrix ADC Session to execute the function against.
.PARAMETER vServerName
    The GSLB Virtual Server Name.
.PARAMETER DomainName
    The GSLB Domain Name.
.NOTES
    Creation Date: 20/06/2018
.CHANGE CONTROL
    Name Version Date Change Detail
    David Brett 1.0 29/03/2018 Function Creation
.EXAMPLE
    Add-ADCGSLBDomainTovServer -vServerName "gslb_vsvr_storefront_london" -DomainName "storefront.gslb.bretty.me.uk" -Verbose
#>


    [CmdletBinding()]
    Param (
        $Session = $script:session,
        [parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName)]
        [string[]]$vServerName = (Read-Host -Prompt 'Enter Virtual Server Name'),
        [string[]]$DomainName = (Read-Host -Prompt 'Enter Domain Name')
    )
       
    begin {
        $PayLoad = @{
            name       = "$vServerName"
            domainname = "$DomainName"
        }
    }
   
    process {
        try {
            Invoke-ADCRestAPI -Session $Session -Method POST -Type "gslbvserver_domain_binding" -Payload $PayLoad -Action Add
            write-verbose "Domain Name ($DomainName) bound to GSLB vServer ($vServerName)"
        }
        catch {
            write-verbose "Domain Name ($DomainName) could not be bound to GSLB vServer ($vServerName)" 
        }
    }

    end {
    }
    
}