VMware Cloud Community
ganapa2000
Hot Shot
Hot Shot
Jump to solution

Disable Perennially Reserve on all devices in Cluster

Hi,

I am trying to disable Perennially Reserve on all devices in Cluster

But it is not working.

Please help.

$esxis = get-cluster MyClus | get-vmhost

foreach ($vmhost in $esxis){
$myesxcli = Get-EsxCli -VMHost $vmhost
$diskinfo = $myesxcli.storage.core.device.list() | Select -ExpandProperty IsPerenniallyReserved
"$($vmhost.Name) $($rdm.Canonical_Name) IsPerenniallyReserved= $($diskinfo)"
if($diskinfo -eq "true")
{
write-host "Configuring Perennial Reservation for LUN " $_.Device ":" $myesxcli.storage.core.device.setconfig($false,$_.Device,$false)
$diskinfo = $myesxcli.storage.core.device.list() | Select -ExpandProperty IsPerenniallyReserved
"$($vmhost.Name) $($_.Device) IsPerenniallyReserved= $($diskinfo)"
"----------------"
}
}

 

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You have to do this device by device.

Something like this for example

Get-Cluster | Get-VMHost -PipelineVariable esx |
ForEach-Object -Process {
    $myesxcli = Get-EsxCli -VMHost $esx -V2
    $myesxcli.storage.core.device.list.Invoke() |
    ForEach-Object -Process {
        Write-Host "$($vmhost.Name) $($_.Device) IsPerenniallyReserved= $($_.IsPerenniallyReserved)"
        if($_.IsPerenniallyReserved){
           Write-Host "Configuring Perennial Reservation for LUN: $($_.Device)"
           $myesxcli.storage.core.device.setconfig.Invoke(@{device=$_.Device;perenniallyreserved=$false})
           Write-Host "$($vmhost.Name) $($_.Device) IsPerenniallyReserved= $($_.IsPerenniallyReserved)"
        }
    }
}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

You have to do this device by device.

Something like this for example

Get-Cluster | Get-VMHost -PipelineVariable esx |
ForEach-Object -Process {
    $myesxcli = Get-EsxCli -VMHost $esx -V2
    $myesxcli.storage.core.device.list.Invoke() |
    ForEach-Object -Process {
        Write-Host "$($vmhost.Name) $($_.Device) IsPerenniallyReserved= $($_.IsPerenniallyReserved)"
        if($_.IsPerenniallyReserved){
           Write-Host "Configuring Perennial Reservation for LUN: $($_.Device)"
           $myesxcli.storage.core.device.setconfig.Invoke(@{device=$_.Device;perenniallyreserved=$false})
           Write-Host "$($vmhost.Name) $($_.Device) IsPerenniallyReserved= $($_.IsPerenniallyReserved)"
        }
    }
}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
ganapa2000
Hot Shot
Hot Shot
Jump to solution

That worked perfectly. Thank you very much 🙂

0 Kudos