StarWind iSCSI SAN
StarWind Native SAN for Hyper-V
 

Rescan Script Errors (PowerShell)

Pure software-based VM-centric and flash-friendly VM storage (iSCSI, SMB3, NFS, iSER and NVMe over Fabrics) including free version. Same software embedded on StarWind ready nodes.

Moderators: art (staff), anton (staff), Anatoly (staff), Max (staff)

Rescan Script Errors (PowerShell)

Postby VirtyManWinds » Fri Mar 01, 2019 2:37 pm

Hi All,

I'm getting some errors recently on the Powershell Rescan Script.

I'm using PowerCLI 11 and ESXi 6.7U1. It's failing when it tires to set the IOPS on the RR:
Response status code does not indicate success: 500 (Internal Server Error).
At C:\rescan_script.ps1:15 char:1
+ $esxcli.storage.nmp.psp.roundrobin.deviceconfig.set(0,$null,$CN.Canon ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], ViError
+ FullyQualifiedErrorId : VMware.VimAutomation.Sdk.Types.V1.ErrorHandling.VimException.ViError


I may have copy/pasted an old version of the script from the web site. Here is my script:
Code: Select all
Import-Module VMware.PowerCLI
$counter = 1
if ($counter -eq 0){
Set-PowerCLIConfiguration -InvalidCertificateAction ignore -Confirm:$false | Out-Null
}
$ESXiHost = "xxxx"
$ESXiUser = "xxxxx"
$ESXiPassword = "xxxx"
Connect-VIServer $ESXiHost -User $ESXiUser -Password $ESXiPassword | Out-Null
Get-VMHostStorage $ESXiHost -RescanAllHba | Out-Null
Get-ScsiLun -VMHost $ESXiHost -LunType disk | Where-Object Vendor -EQ "STARWIND"|Where-Object ConsoleDeviceName -NE " " | Set-ScsiLun -MultipathPolicy RoundRobin |Out-Null
$StarwindCN = Get-ScsiLun -VMHost $ESXiHost -LunType disk |Where-Object Vendor -EQ "STARWIND" | Where-Object ConsoleDeviceName -NE " " | Select-Object CanonicalName
$esxcli = Get-EsxCli -VMHost $ESXiHost
foreach($CN in $StarwindCN){
$esxcli.storage.nmp.psp.roundrobin.deviceconfig.set(0,$null,$CN.CanonicalName,1,"iops",0) | Out-Null
}
Disconnect-VIServer $ESXiHost -Confirm:$false
$file = Get-Content "$PSScriptRoot\rescan_script.ps1"
if ($file[1] -ne "`$counter = 1") {
$file[1] = "`$counter = 1"
$file > "$PSScriptRoot\rescan_script.ps1"
}


Any help would be awesome!
VirtyManWinds
 
Posts: 2
Joined: Fri Mar 01, 2019 2:31 pm

Re: Rescan Script Errors (PowerShell)

Postby Oleg(staff) » Fri Mar 01, 2019 3:12 pm

Please check this script:
Code: Select all
Import-Module VMware.PowerCLI
$counter = 0
if ($counter -eq 0){
Set-PowerCLIConfiguration -InvalidCertificateAction ignore -Confirm:$false|
Out-Null
}
$ESXiHost = "host_IP"
$ESXiUser = "user"
$ESXiPassword = "password"
Connect-VIServer $ESXiHost -User $ESXiUser -Password $ESXiPassword | Out-Null
Get-VMHostStorage $ESXiHost -RescanAllHba | Out-Null
Get-ScsiLun -VMHost $ESXiHost -LunType disk | Where-Object Vendor -EQ "STARWIND"|
Where-Object ConsoleDeviceName -NE " " | Set-ScsiLun -MultipathPolicy RoundRobin -CommandsToSwitchPath 1 |
Out-Null
Disconnect-VIServer $ESXiHost -Confirm:$false
$file = Get-Content "$PSScriptRoot\rescan_script.ps1"
if ($file[1] -ne "`$counter = 1") {
$file[1] = "`$counter = 1"
$file > "$PSScriptRoot\rescan_script.ps1"
}
Oleg(staff)
Staff
 
Posts: 567
Joined: Fri Nov 24, 2017 7:52 am

Re: Rescan Script Errors (PowerShell)

Postby VirtyManWinds » Fri Mar 01, 2019 8:27 pm

That worked great! Thank you!

It set the RoudRobin and IOPS RR to 1 perfectly.

For reference I was using this guide that had the outdated script: https://www.starwindsoftware.com/resour ... sphere-6-5

I suppose they changed the API command is why it was erroring out.
VirtyManWinds
 
Posts: 2
Joined: Fri Mar 01, 2019 2:31 pm

Re: Rescan Script Errors (PowerShell)

Postby Oleg(staff) » Sun Mar 03, 2019 8:25 am

Thank you for confirmation.
Correct, there were some changes in ESXi 6.7, we will update the information in the documentation.
Oleg(staff)
Staff
 
Posts: 567
Joined: Fri Nov 24, 2017 7:52 am


Return to StarWind Virtual SAN / StarWind Virtual SAN Free / StarWind HyperConverged Appliance / StarWind Storage Appliance

Who is online

Users browsing this forum: Google [Bot] and 6 guests