Private/Add-ADCServer.ps1

function Add-ADCServer {
    <#
.SYNOPSIS
    Adds a Server to the Citrix ADC.
.DESCRIPTION
    Adds a Server to the Citrix ADC.
.PARAMETER Session
    The Citrix ADC Session to execute the function against.
.PARAMETER ServerName
    The Service Name.
.PARAMETER ServerIP
    The 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-ADCServer -ServerName "web01.bretty.me.uk" -ServerIP "192.168.0.10" -Verbose
#>


    [CmdletBinding()]
    Param (
        $Session = $script:session,
        [parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName)]
        [string[]]$ServerName = (Read-Host -Prompt 'Enter Server Name'),
        [string[]]$ServerIP = (Read-Host -Prompt 'Enter Server IP Address')
    )

    begin {
        $PayLoad = @{
            name      = "$ServerName"
            ipaddress = "$ServerIP"
        }
    }

    process {
        try {
            Invoke-ADCRestAPI -Session $Session -Method POST -Type "server" -Payload $PayLoad -Action Add
            write-verbose "Server ($ServerName) added on IP Address ($ServerIP)"
        }
        catch {
            write-verbose "Server ($ServerName) could not be added on IP Address ($ServerIP)" 
        }
    }

    end {
    }
    
}