Skip to content

Commit cbeddc5

Browse files
committed
Fix PSScriptAnalyzer warnings with Where-Object alias and unused variables
1 parent d8c5a33 commit cbeddc5

18 files changed

+44
-46
lines changed

NetScaler/Public/Add-NSCertKeyPair.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ function Add-NSCertKeyPair {
108108
$unsecurePassword = $creds.GetNetworkCredential().Password
109109
$params.Add("passplain",$unsecurePassword)
110110
}
111-
$response = _InvokeNSRestApi -Session $Session -Method POST -Type sslcertkey -Payload $params -Action add
111+
_InvokeNSRestApi -Session $Session -Method POST -Type sslcertkey -Payload $params -Action add > Out-Null
112112
} catch {
113113
throw $_
114114
}

NetScaler/Public/Add-NSDnsNameServer.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ function Add-NSDnsNameServer {
103103
$params.Add('dnsvservername', $DNSVServerName)
104104
}
105105

106-
$response = _InvokeNSRestApi -Session $Session -Method POST -Type dnsnameserver -Payload $params -Action add
107-
106+
_InvokeNSRestApi -Session $Session -Method POST -Type dnsnameserver -Payload $params -Action add > Out-Null
108107
} catch {
109108
throw $_
110109
}

NetScaler/Public/Add-NSDnsSuffix.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function Add-NSDnsSuffix {
6262
$params = @{
6363
dnssuffix = $item;
6464
}
65-
$response = _InvokeNSRestApi -Session $Session -Method POST -Type dnssuffix -Payload $params -Action add
65+
_InvokeNSRestApi -Session $Session -Method POST -Type dnssuffix -Payload $params -Action add > Out-Null
6666
}
6767
catch {
6868
throw $_

NetScaler/Public/Add-NSIPResource.ps1

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,30 @@ function Add-NSIPResource {
3131
The NetScaler session object.
3232
3333
.PARAMETER IPAddress
34-
IPv4 address to create on the NetScaler appliance.
34+
IPv4 address to create on the NetScaler appliance.
3535
3636
Note: Cannot be changed after the IP address is created
3737
3838
.PARAMETER SubnetMask
3939
Subnet mask associated with the IP address.
4040
4141
.PARAMETER Type
42-
Type of the IP address to create on the NetScaler appliance. Cannot be changed after the IP address is created.
43-
44-
The following are the different types of NetScaler owned IP addresses:
42+
Type of the IP address to create on the NetScaler appliance. Cannot be changed after the IP address is created.
43+
44+
The following are the different types of NetScaler owned IP addresses:
4545
4646
* A Subnet IP (SNIP) address is used by the NetScaler ADC to communicate with the servers.
4747
The NetScaler also uses the subnet IP address when generating its own packets, such as packets related to dynamic routing
48-
protocols, or to send monitor probes to check the health of the servers.
48+
protocols, or to send monitor probes to check the health of the servers.
4949
5050
* A Virtual IP (VIP) address is the IP address associated with a virtual server. It is the IP address to which clients connect.
51-
An appliance managing a wide range of traffic may have many VIPs configured. Some of the attributes of the VIP address are
52-
customized to meet the requirements of the virtual server.
53-
51+
An appliance managing a wide range of traffic may have many VIPs configured. Some of the attributes of the VIP address are
52+
customized to meet the requirements of the virtual server.
53+
5454
* A GSLB site IP (GSLBIP) address is associated with a GSLB site. It is not mandatory to specify a GSLBIP address when you
55-
initially configure the NetScaler appliance. A GSLBIP address is used only when you create a GSLB site.
56-
57-
* A Cluster IP (CLIP) address is the management address of the cluster. All cluster configurations must be performed by
55+
initially configure the NetScaler appliance. A GSLBIP address is used only when you create a GSLB site.
56+
57+
* A Cluster IP (CLIP) address is the management address of the cluster. All cluster configurations must be performed by
5858
accessing the cluster through this IP address.
5959
6060
Default value: SNIP
@@ -88,7 +88,7 @@ function Add-NSIPResource {
8888
[string]$Type = 'SNIP',
8989

9090
[switch]$VServer,
91-
91+
9292
[switch]$MgmtAccess
9393
)
9494

@@ -107,7 +107,7 @@ function Add-NSIPResource {
107107
vserver = if ($PSBoundParameters.ContainsKey('VServer')) { 'ENABLED' } else { 'DISABLED' }
108108
mgmtaccess = if ($PSBoundParameters.ContainsKey('MgmtAccess')) { 'ENABLED' } else { 'DISABLED' }
109109
}
110-
$response = _InvokeNSRestApi -Session $Session -Method POST -Type nsip -Payload $params -Action add
110+
_InvokeNSRestApi -Session $Session -Method POST -Type nsip -Payload $params -Action add > Out-Null
111111
} catch {
112112
throw $_
113113
}

NetScaler/Public/Add-NSSSLCertificateLink.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function Add-NSSSLCertificateLink {
5858
certkey = $CertKeyName
5959
linkcertkeyname = $IntermediateCertKeyName
6060
}
61-
$response = _InvokeNSRestApi -Session $Session -Method POST -Type sslcertkey -Payload $params -Action link
61+
_InvokeNSRestApi -Session $Session -Method POST -Type sslcertkey -Payload $params -Action link > Out-Null
6262
}
6363
catch {
6464
throw $_

NetScaler/Public/Connect-NetScaler.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function Connect-NetScaler {
5656
[string]$Hostname,
5757

5858
[parameter(Mandatory)]
59-
[pscredential]$Credential = (Get-Credential -Message 'NetScaler credential'),
59+
[pscredential]$Credential,
6060

6161
[int]$Timeout = 900,
6262

@@ -83,14 +83,14 @@ function Connect-NetScaler {
8383
$session | Add-Member -NotePropertyName Scheme -NotePropertyValue $scheme -TypeName String
8484
$session | Add-Member -Name Uri -MemberType ScriptProperty -Value {
8585
"$($this.scheme)://$($this.endpoint)/nitro/v1"
86-
}
86+
}
8787
$session | Add-Member -Name CreateUri -MemberType ScriptMethod -Value {
8888
Param(
8989
[String]$service,
9090
[String]$type
9191
)
9292
"$($this.Uri)/$service/$type"
93-
}
93+
}
9494

9595
Write-Verbose -Message "Connecting to $($session.Uri)..."
9696

NetScaler/Public/Get-NSAAAGroup.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function Get-NSAAAGroup {
2222
.DESCRIPTION
2323
Gets NetScaler AAA group(s). If no parameters are provided all AAA
2424
groups are returned. The 'Groupname' and 'Filter' parameters can be
25-
used to select a specific group or groups.
25+
used to select a specific group or groups.
2626
2727
.EXAMPLE
2828
Get-NSAAAGroup
@@ -72,13 +72,13 @@ function Get-NSAAAGroup {
7272
if (-Not([string]::IsNullOrEmpty($Name))) {
7373
foreach ($Group in $Name) {
7474
$response = _InvokeNSRestApi -Session $Session -Method Get -Type aaagroup -Resource $Group -Action Get
75-
if ($response.psobject.properties | where name -eq aaagroup) {
75+
if ($response.psobject.properties | Where-Object {$_.name -eq 'aaagroup'}) {
7676
$response.aaagroup
7777
}
7878
}
7979
} else {
8080
$response = _InvokeNSRestApi -Session $Session -Method Get -Type aaagroup -Action Get
81-
if ($response.psobject.properties | where name -eq aaagroup) {
81+
if ($response.psobject.properties | Where-Object {$_.name -eq 'aaagroup'}) {
8282
if (-Not([string]::IsNullOrEmpty($Filter))) {
8383
foreach ($item in $response.aaagroup) {
8484
if ($item.groupname -match "$Filter") {

NetScaler/Public/Get-NSAAAGroupBinding.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function Get-NSAAAGroupBinding {
2020
Gets NetScaler AAA group(s) session policy bindings.
2121
2222
.DESCRIPTION
23-
Gets NetScaler AAA group(s) session policy bindings.
23+
Gets NetScaler AAA group(s) session policy bindings.
2424
2525
.EXAMPLE
2626
Get-NSAAAGroupBinding -Groupname Group1
@@ -61,7 +61,7 @@ function Get-NSAAAGroupBinding {
6161
Try {
6262
foreach ($Group in $Name) {
6363
$response = _InvokeNSRestApi -Session $Session -Method Get -Type aaagroup_binding -Resource $Group -Action Get
64-
if ($response.psobject.properties | where name -eq aaagroup_binding) {
64+
if ($response.psobject.properties | Where-Object {$_.name -eq 'aaagroup_binding'}) {
6565
$response.aaagroup_binding
6666
}
6767
}

NetScaler/Public/Get-NSAAAUser.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function Get-NSAAAUser {
2222
.DESCRIPTION
2323
Gets NetScaler AAA user(s). If no parameters are provided all AAA
2424
users are returned. The 'Username' and 'Filter' parameters can be
25-
used to select a specific user or a subset of users.
25+
used to select a specific user or a subset of users.
2626
2727
.EXAMPLE
2828
Get-NSAAAUser
@@ -72,13 +72,13 @@ function Get-NSAAAUser {
7272
if (-Not([string]::IsNullOrEmpty($Name))) {
7373
foreach ($User in $Name) {
7474
$response = _InvokeNSRestApi -Session $Session -Method Get -Type aaauser -Resource $User -Action Get
75-
if ($response.psobject.properties | where name -eq aaauser) {
75+
if ($response.psobject.properties | Where-Object {$_.name -eq 'aaauser'}) {
7676
$response.aaauser
7777
}
7878
}
7979
} else {
8080
$response = _InvokeNSRestApi -Session $Session -Method Get -Type aaauser -Action Get
81-
if ($response.psobject.properties | where name -eq aaauser) {
81+
if ($response.psobject.properties | Where-Object {$_.name -eq 'aaauser'}) {
8282
if (-Not([string]::IsNullOrEmpty($Filter))) {
8383
foreach ($item in $response.aaauser) {
8484
if ($item.username -match "$Filter") {

NetScaler/Public/Get-NSAAAUserBinding.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function Get-NSAAAUserBinding {
2020
Gets NetScaler AAA user(s) session policy bindings.
2121
2222
.DESCRIPTION
23-
Gets NetScaler AAA user(s) session policy bindings.
23+
Gets NetScaler AAA user(s) session policy bindings.
2424
2525
.EXAMPLE
2626
Get-NSAAAUserBinding -Username User1
@@ -61,7 +61,7 @@ function Get-NSAAAUserBinding {
6161
Try {
6262
foreach ($User in $Name) {
6363
$response = _InvokeNSRestApi -Session $Session -Method Get -Type aaauser_binding -Resource $User -Action Get
64-
if ($response.psobject.properties | where name -eq aaauser_binding) {
64+
if ($response.psobject.properties | Where-Object {$_.name -eq 'aaauser_binding'}) {
6565
$response.aaauser_binding
6666
}
6767
}

0 commit comments

Comments
 (0)