Skip to content

Commit 4479720

Browse files
committed
Added Clear-NSAAASession.ps1
1 parent a10befa commit 4479720

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

NetScaler/NetScaler.psd1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ FunctionsToExport = @(
8282
'Add-NSSSLCertificateLink',
8383
'Add-NSSystemFile',
8484
'Add-NSVPNVirtualServerBinding',
85+
'Clear-NSAAASession',
8586
'Clear-NSConfig',
8687
'Connect-NetScaler',
8788
'Disable-NSFeature',
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<#
2+
Copyright 2016 Dominique Broeglin
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
#>
16+
17+
function Clear-NSAAASession {
18+
<#
19+
.SYNOPSIS
20+
Clear NetScaler AAA sessions.
21+
22+
.DESCRIPTION
23+
Clear NetScaler AAA sessions.
24+
25+
.EXAMPLE
26+
Clear-NSAAASessions
27+
28+
Clears all AAA sessions.
29+
30+
.PARAMETER Session
31+
The NetScaler session object.
32+
33+
.PARAMETER Force
34+
Suppress confirmation when clearing the sessions.
35+
36+
.Notes
37+
Nitro implementation status: partial
38+
#>
39+
[cmdletbinding(SupportsShouldProcess = $true, ConfirmImpact='High')]
40+
param(
41+
$Session = $Script:Session,
42+
43+
[switch]$Force
44+
)
45+
46+
begin {
47+
_AssertSessionActive
48+
}
49+
process {
50+
$ip = $($Session.EndPoint)
51+
if ($Force -or $PSCmdlet.ShouldProcess($ip, "Clear AAA sessions")) {
52+
_InvokeNSRestApi -Session $Session -Method POST -Type aaasession -Action kill -Payload @{ "all" = $True }
53+
}
54+
}
55+
}

0 commit comments

Comments
 (0)