Private/Add-ADCGSLBvServer.ps1

function Add-ADCGSLBvServer {
    <#
.SYNOPSIS
    Adds a GSLB Load Balancing Server to the Citrix ADC.
.DESCRIPTION
    Adds a GSLB Load Balancing Server to the Citrix ADC.
.PARAMETER Session
    The Citrix ADC Session to execute the function against.
.PARAMETER vServerName
    The GSLB Virtual Server Name.
.PARAMETER ServiceType
    The GSLB vServer 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-ADCGSLBvServer -vServerName "galb_vsvr_storefront_443" -ServiceType "SSL" -Verbose
#>


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

    begin {
        $PayLoad = @{
            name        = "$vServerName"
            servicetype = "$ServiceType"
        }
    }
    process {
        try {
            Invoke-ADCRestAPI -Session $Session -Method POST -Type "gslbvserver" -Payload $PayLoad -Action Add
            write-verbose "GSLB vServer (vServerName) added to Citrix ADC of type ($ServiceType)"
        }
        catch {
            write-verbose "GSLB vServer (vServerName) could not be added to Citrix ADC of type ($ServiceType)" 
        }
    }

    end {
    }

}