Rescan Script Errors (PowerShell)
Posted: 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:
Any help would be awesome!
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:
I may have copy/pasted an old version of the script from the web site. Here is my script: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
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"
}