Skip to content

Commit a10befa

Browse files
authored
Merge pull request #57 from daimhin/my_contribution
Adds Graceful parameter to the Disable-NSLBServer cmdlet
2 parents 0b1ff66 + d32669c commit a10befa

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

NetScaler/Public/Disable-NSLBServer.ps1

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,20 @@ function Disable-NSLBServer {
3737
3838
Disable the load balancer server 'server01' without confirmation and return the resulting object.
3939
40+
.EXAMPLE
41+
$server = Disable-NSLBServer -Name 'server01' -Graceful 60 -Force -PassThru
42+
43+
Disable the load balancer server 'server01' without confirmation, giving a 60 second grace period before disabling and return the resulting object.
44+
4045
.PARAMETER Session
4146
The NetScaler session object.
4247
4348
.PARAMETER Name
4449
The name or names of the load balancer servers to disable.
4550
51+
.PARAMETER Graceful
52+
Indicates graceful shutdown of the server. System will wait for all outstanding connections to this server to be closed before disabling the server. Wait time in seconds may be included before disabling happens.
53+
4654
.PARAMETER Force
4755
Suppress confirmation when disabling the server.
4856
@@ -55,7 +63,9 @@ function Disable-NSLBServer {
5563

5664
[parameter(Mandatory,ValueFromPipeline = $true, ValueFromPipelineByPropertyName)]
5765
[string[]]$Name = (Read-Host -Prompt 'LB server name'),
58-
66+
67+
[int]$Graceful,
68+
5969
[switch]$Force,
6070

6171
[switch]$PassThru
@@ -72,6 +82,14 @@ function Disable-NSLBServer {
7282
$params = @{
7383
name = $item
7484
}
85+
if ($PSBoundParameters.ContainsKey('Graceful')) {
86+
$params.Add('graceful', 'YES')
87+
if ($Graceful -gt 0) {
88+
$params.Add('delay', $Graceful)
89+
} else {
90+
$params.Add('delay', 0)
91+
}
92+
}
7593
_InvokeNSRestApi -Session $Session -Method POST -Type server -Payload $params -Action disable
7694

7795
if ($PSBoundParameters.ContainsKey('PassThru')) {

0 commit comments

Comments
 (0)