Skip to content

Commit ee6af6b

Browse files
committed
NonAddressable Support
Added paramater NonAddressable to allow the creation of a Virtual Server that does not need the IP Address or Port number assignment.
1 parent 7f5cab6 commit ee6af6b

File tree

1 file changed

+32
-15
lines changed

1 file changed

+32
-15
lines changed

NetScaler/Public/New-NSLBVirtualServer.ps1

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ function New-NSLBVirtualServer {
4545
.PARAMETER IPAddress
4646
IPv4 or IPv6 address to assign to the virtual server.
4747
48+
.PARAMETER NonAddressable
49+
Bypasses the need for an IPAddress and port for the virtual server to configure it as "Non Addressable"
50+
4851
.PARAMETER Comment
4952
Any comments that you might want to associate with the virtual server.
5053
@@ -141,17 +144,21 @@ function New-NSLBVirtualServer {
141144

142145
[parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)]
143146
[string[]]$Name = (Read-Host -Prompt 'LB virtual server name'),
144-
145-
[parameter(Mandatory)]
147+
148+
[Parameter(Mandatory = $true, ParameterSetName = "Addressable")]
146149
[ValidateScript({$_ -match [IPAddress]$_ })]
147150
[string]$IPAddress,
148-
149-
[ValidateLength(0, 256)]
150-
[string]$Comment = '',
151-
151+
152+
[Parameter(Mandatory = $true, ParameterSetName = "NonAddressable")]
153+
[Switch]$NonAddressable,
154+
155+
[Parameter(Mandatory = $true, ParameterSetName = "Addressable")]
152156
[ValidateRange(1, 65534)]
153157
[int]$Port = 80,
154-
158+
159+
[ValidateLength(0, 256)]
160+
[string]$Comment = '',
161+
155162
[ValidateSet('DHCPRA','DIAMTER', 'DNS', 'DNS_TCP', 'DLTS', 'FTP', 'HTTP', 'MSSQL', 'MYSQL', 'NNTP', 'PUSH','RADIUS', 'RDP', 'RTSP', 'SIP_UDP', 'SSL', 'SSL_BRIDGE', 'SSL_DIAMETER', 'SSL_PUSH', 'SSL_TCP', 'TCP', 'TFTP', 'UDP')]
156163
[string]$ServiceType = 'HTTP',
157164

@@ -192,14 +199,24 @@ function New-NSLBVirtualServer {
192199
foreach ($item in $Name) {
193200
if ($PSCmdlet.ShouldProcess($item, 'Create Virtual Server')) {
194201
try {
195-
$params = @{
196-
name = $item
197-
comment = $comment
198-
servicetype = $ServiceType
199-
ipv46 = $IPAddress
200-
port = $Port
201-
lbmethod = $LBMethod
202-
icmpvsrresponse = $ICMPVSResponse
202+
if ($NonAddressable) {
203+
$params = @{
204+
name = $item
205+
comment = $comment
206+
servicetype = $ServiceType
207+
lbmethod = $LBMethod
208+
icmpvsrresponse = $ICMPVSResponse
209+
}
210+
} else {
211+
$params = @{
212+
name = $item
213+
comment = $comment
214+
servicetype = $ServiceType
215+
ipv46 = $IPAddress
216+
port = $Port
217+
lbmethod = $LBMethod
218+
icmpvsrresponse = $ICMPVSResponse
219+
}
203220
}
204221

205222
if ($PSBoundParameters.ContainsKey('PersistenceType')) {

0 commit comments

Comments
 (0)