Private/Add-ADCService.ps1
function Add-ADCService { <# .SYNOPSIS Adds a Load Balancing Service to the Citrix ADC. .DESCRIPTION Adds a Load Balancing Service to the Citrix ADC. .PARAMETER Session The Citrix ADC Session to execute the function against. .PARAMETER ServiceName The Service Name. .PARAMETER ServiceType The Service Type. .PARAMETER ServicePort The Service Port to use. .PARAMETER ServerName The Server to point the Service to. .NOTES Creation Date: 20/06/2018 .CHANGE CONTROL Name Version Date Change Detail David Brett 1.0 29/03/2018 Function Creation .EXAMPLE Add-ADCService -ServiceName "svc_citrix_storefront_443" -ServiceType "SSL" -ServicePort 443 -ServerName "web01.bretty.me.uk" -Verbose #> [CmdletBinding()] Param ( $Session = $script:session, [parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName)] [string[]]$ServiceName = (Read-Host -Prompt 'Enter Service Name'), [string[]]$ServiceType = (Read-Host -Prompt 'Enter Service Type'), [int[]]$ServicePort = (Read-Host -Prompt 'Enter Service Port'), [string[]]$ServerName = (Read-Host -Prompt 'Enter Server Name') ) $PayLoad = @{ name = "$ServiceName" servicetype = "$ServiceType" port = "$ServicePort" servername = "$ServerName" } Invoke-ADCRestAPI -Session $Session -Method POST -Type "service" -Payload $PayLoad -Action Add write-verbose "Load Balancing Service ($ServiceName) added to the Citrix ADC of type ($ServiceType) on Port ($ServicePort) pointing to ($ServerName)" } |