Private/Add-ADCLoadBalancingvServer.ps1

function Add-ADCLoadBalancingvServer {
    <#
.SYNOPSIS
    Adds a Load Balancing vServer Server to the Citrix ADC.
.DESCRIPTION
    Adds a Load Balancing vServer Server to the Citrix ADC.
.PARAMETER Session
    The Citrix ADC Session to execute the function against.
.PARAMETER vServerName
    The Virtual Server Name.
.PARAMETER vServerType
    The Virtual Server Type.
.PARAMETER vServerIPv4
    The IP Address for the Virtual Server
.PARAMETER vServerPort
    The port for the 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
    Add-ADCLoadBalancingvServer -vServerName "vsvr_storefront_443" -vServerType "SSL" -vServerIPv4 "192.168.0.11" -vServerPort 443 -Verbose
#>


    [CmdletBinding()]
    Param (
        $Session = $script:session,
        [parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName)]
        [string[]]$vServerName = (Read-Host -Prompt 'Enter Virtual Server Name'),
        [string[]]$vServerType = (Read-Host -Prompt 'Enter Virtual Server Type'),
        [string[]]$vServerIPv4 = (Read-Host -Prompt 'Enter Virtual Server IPv4 Address'),
        [int[]]$vServerPort = (Read-Host -Prompt 'Enter Virtual Server Port')
    )

    $PayLoad = @{
        name = "$vServerName"
        servicetype = "$vServerType"
        ipv46 = "$vServerIPv4"
        port = "$vServerPort"
    }

    Invoke-ADCRestAPI -Session $Session -Method POST -Type "lbvserver" -Payload $PayLoad -Action Add
    write-verbose "Load Balancing vServer ($vServerName) add tot he Citrix ADC of type ($vServerType) on IP Address ($vServerIPv4) on port ($vServerPort)"
}