Skip to content

Commit 1560056

Browse files
committed
Added Remove-NSSystemFile
1 parent 4c3ea7b commit 1560056

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

NetScaler/NetScaler.psd1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ FunctionsToExport = @(
188188
'Remove-NSResponderAction',
189189
'Remove-NSSSLCertificateLink',
190190
'Remove-NSSSLProfile',
191+
'Remove-NSSystemFile',
191192
'Remove-NSVPNSessionPolicy',
192193
'Remove-NSVPNSessionProfile',
193194
'Restart-NetScaler',
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<#
2+
Copyright 2017 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 Remove-NSSystemFile {
18+
<#
19+
.SYNOPSIS
20+
Remove a system file from the NetScaler.
21+
22+
.DESCRIPTION
23+
Remove a system file from the NetScaler.
24+
25+
.EXAMPLE
26+
Remove-NSSystemFile -Name 'test.tgz'
27+
28+
Remove a system file called 'test.tgz' from the NetScaler.
29+
30+
.PARAMETER Session
31+
The NetScaler session object.
32+
33+
.PARAMETER Name
34+
Name of the system file to remove.
35+
36+
.PARAMETER FileLocation
37+
Location of the system file to remove.
38+
39+
.PARAMETER Force
40+
Suppress confirmation when removing a system file.
41+
#>
42+
[cmdletbinding(SupportsShouldProcess = $true, ConfirmImpact='Medium')]
43+
param(
44+
$Session = $script:session,
45+
46+
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
47+
[Alias('Filename')]
48+
[string[]]$Name,
49+
50+
[Parameter(Mandatory)]
51+
[string]$FileLocation,
52+
53+
[switch]$Force
54+
)
55+
56+
begin {
57+
_AssertSessionActive
58+
}
59+
60+
process {
61+
foreach ($item in $Name) {
62+
if ($Force -or $PSCmdlet.ShouldProcess($item, "Delete file $FileLocation/$Name")) {
63+
_InvokeNSRestApi -Session $Session -Method DELETE -Type systemfile -Resource $item -Action delete -Arguments @{ filelocation = $FileLocation }
64+
}
65+
}
66+
}
67+
}

0 commit comments

Comments
 (0)