Skip to content

Commit 8ff1c52

Browse files
committed
Made changes to appease lint.
1 parent 7b8241f commit 8ff1c52

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Management-Utilities/iscsi-vol-create-and-mount/CreateDisk.ps1

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWriteHost', '', Justification='This script intentinally uses Write-Host to display messages to the user.')]
12
#### Getting param ####
23
param(
34
[Parameter(Mandatory=$true,HelpMessage="Enter FSxN filesystem management IP")]
45
[string]$ip,
56
[Parameter(Mandatory=$true,HelpMessage="Enter FSxN username")]
67
[string]$user,
78
[Parameter(Mandatory=$true,HelpMessage="Enter FSx filesystem password")]
8-
[string]$password,
9+
[SecureString]$password,
910
[Parameter(Mandatory=$true,HelpMessage="Enter volume size (in GB)")]
1011
[string]$volSize,
1112
[Parameter(Mandatory=$true,HelpMessage="Enter drive letter")]
@@ -15,7 +16,7 @@ param(
1516
[string]$format_disk)
1617

1718
Write-Host "Getting disks numbers before startig..." -ForegroundColor yellow
18-
$totaldisks = (get-disk | Sort-Object -Property number | Select -Last 1 -ExpandProperty number)
19+
$totaldisks = (get-disk | Sort-Object -Property number | Select-Object -Last 1 -ExpandProperty number)
1920
Write-Host "Getting local disks before startig..." -ForegroundColor yellow
2021
Write-Host "There are $totaldisks disks" -ForegroundColor yellow
2122

@@ -25,7 +26,7 @@ $lun_name = "drive_" + $vol_number
2526
$igroup_name = "winhost_ig_" + $vol_number
2627

2728
#### check if letter drive already in used and in the correct format ####
28-
if($drive_letter.Length > 1)
29+
if($drive_letter.Length -gt 1)
2930
{
3031
Write-Host "Drive letter not in the correct format" -ForegroundColor Red
3132
break
@@ -65,7 +66,7 @@ Write-Host "Connectiong to FSx filesystem" -ForegroundColor Yellow
6566
$PWord = ConvertTo-SecureString -String $password -AsPlainText -Force
6667
$credntials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $user, $PWord
6768
try {
68-
$controller = Connect-NcController $ip -Credential $credntials -ErrorAction Stop
69+
Connect-NcController $ip -Credential $credntials -ErrorAction Stop
6970
}
7071
catch {
7172
Write-Host "Failed connect to FSx filesystem, due to: $_" -ForegroundColor Red
@@ -149,14 +150,14 @@ Write-host 'Online, Initialize and format disks' -ForegroundColor Yellow
149150
Start-Sleep -Seconds 10
150151
$maxRetries = 5
151152
$counter = 0
152-
$diskNum = (get-disk | Sort-Object -Property number | Select -Last 1 -ExpandProperty number)
153+
$diskNum = (get-disk | Sort-Object -Property number | Select-Object -Last 1 -ExpandProperty number)
153154
while ($diskNum -eq $totaldisks -and $counter -lt $maxRetries)
154155
{
155156

156157
Write-host 'retry..'
157158
$counter += 1
158159
Start-Sleep -Seconds 10
159-
$diskNum = (get-disk | Sort-Object -Property number | Select -Last 1 -ExpandProperty number)
160+
$diskNum = (get-disk | Sort-Object -Property number | Select-Object -Last 1 -ExpandProperty number)
160161
}
161162

162163
if($counter -eq $maxRetries)

0 commit comments

Comments
 (0)