Hi,
I would like to set the out standing IO value to all naa devices using the input csv file.
Is there a way to perform using the PowerCLI for below command
esxcli storage core device set -O 128 -d naa.6000xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Please help
You could try something like this
ForEach-Object -Process {
$esxcli = Get-EsxCli -VMHost $esx -V2
Import-Csv -Path .\names.csv -UseCulture -PipelineVariable row |
ForEach-Object -Process {
try{
$lun = $esxcli.storage.core.device.list.Invoke(@{device="$($row.CanonicalName)"})
if($lun.NoofoutstandingIOswithcompetingworlds -ne 128){
$newValue = @{
device = "$($row.CanonicalName)"
schednumreqoutstanding = 128
}
$esxcli.storage.core.device.set.Invoke()
Write-Host "LUN $($row.CanonicalName) on $($esx.Name) outstanding IO value set to 128"
}
else{
Write-Host "LUN $($row.CanonicalName) on $($esx.Name) already has outstanding IO value of 128"
}
}
catch{
Write-Host "LUN $($row.CanonicalName) not found on $($esx.Name)"
}
}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Just to make sure I understand correctly, you have the CanonicalName of the LUN and the IO value in the CSV?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD,
I have CanonicalName of the LUN in the list, I want to change the value from 32 to 128
You could try something like this
ForEach-Object -Process {
$esxcli = Get-EsxCli -VMHost $esx -V2
Import-Csv -Path .\names.csv -UseCulture -PipelineVariable row |
ForEach-Object -Process {
try{
$lun = $esxcli.storage.core.device.list.Invoke(@{device="$($row.CanonicalName)"})
if($lun.NoofoutstandingIOswithcompetingworlds -ne 128){
$newValue = @{
device = "$($row.CanonicalName)"
schednumreqoutstanding = 128
}
$esxcli.storage.core.device.set.Invoke()
Write-Host "LUN $($row.CanonicalName) on $($esx.Name) outstanding IO value set to 128"
}
else{
Write-Host "LUN $($row.CanonicalName) on $($esx.Name) already has outstanding IO value of 128"
}
}
catch{
Write-Host "LUN $($row.CanonicalName) not found on $($esx.Name)"
}
}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Perfect LucD. That worked.