sbheema
VMware Employee
VMware Employee

Hi there,

IHAC who has added a new ESXi host to the cluster, without any VM's running on the host. They would like to set RDMs to perennially reserved on that specific host. Please correct me if the below script would work in case Get-VM details are not called in the below script. 

$esxName = 'MyEsx'

$esx = Get-VMHost -Name $esxName

$rdms = $esx | Get-HardDisk -DiskType "RawPhysical","RawVirtual" | Select -Unique ScsiCanonicalName

$esxcli = Get-EsxCli -VMHost $esx -V2

foreach($rdm in $rdms){

    $naaid = $rdm.ScsiCanonicalName

    $esxcli.storage.core.device.setconfig(@{device=$naaid;perenniallyreserved=$true})

    }

}

Reply
0 Kudos