Private/Add-ADCGSLBService.ps1

function Add-ADCGSLBService {
    <#
.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 ServiceName
    The GSLB Service Name.
.PARAMETER ServerName
    The GSLB vServer Name.
.PARAMETER SiteName
    The GSLB Site Name
.PARAMETER Port
    The GSLB Service Port
.PARAMETER ServiceType
    The GSLB Service Type
.NOTES
    Creation Date: 20/06/2018
.CHANGE CONTROL
    Name Version Date Change Detail
    David Brett 1.0 29/03/2018 Function Creation
.EXAMPLE
    Add-ADCGSLBService -ServiceName "gslb_svc_storefront_london" -ServerName "vsvr_storefront_london_vip" -ServiceType "SSL"-SiteName "gslb_site_london" -Port 443 -Verbose
#>


    [CmdletBinding()]
    Param (
        $Session = $script:session,
        [parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName)]
        [string[]]$ServiceName = (Read-Host -Prompt 'Enter GSLB Service Name'),
        [string[]]$ServerName = (Read-Host -Prompt 'Enter GSLB Server Namet'),
        [string[]]$ServiceType = (Read-Host -Prompt 'Enter GSLB Service Type'),
        [string[]]$SiteName = (Read-Host -Prompt 'Enter GSLB Site Name'),
        [int[]]$Port = (Read-Host -Prompt 'Enter GSLB Service Port')
    )

    begin {
        $PayLoad = @{
            servicename = "$ServiceName"
            servername  = "$ServerName"
            servicetype = "$ServiceType"
            sitename    = "$SiteName"
            port        = "$Port"
        }
    }

    process {
        try {
            Invoke-ADCRestAPI -Session $Session -Method POST -Type "gslbservice" -Payload $PayLoad -Action Add
            write-verbose "GSLB Service ($ServiceName) added to the Citrix ADC on Site ($SiteName) of type ($ServiceType) on port ($Port) pointing to ($ServerName)"
        }
        catch {
            write-verbose "GSLB Service ($ServiceName) could not be added to the Citrix ADC on Site ($SiteName) of type ($ServiceType) on port ($Port) pointing to ($ServerName)" 
        }
    }

    end {
    }

}