- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So I found this script to set the RDMs to Perennially Reserved, however, we have probably 15-20 VMs with RDMs so doing this manually can be tough. I'd like to be able to have PowerCLI build a list of all the RDMs.
I tried to build a foreach loop around the existing one one to detect all the RDMs from the multiple VMs using: Get-VM | Get-HardDisk -DiskType "RawPhysical","RawVirtual" | Select Parent but was unsuccessful.
$vmName = "VMwithRDM"
$vm = Get-VM -Name $vmName
$rdm = Get-HardDisk -DiskType rawPhysical -Vm $vm
$vmhosts = Get-Cluster -VM $vm | Get-VMHost
foreach($esx in $vmhosts){
$esxcli = Get-EsxCli -VMHost $esx
Get-HardDisk -DiskType rawPhysical -Vm $vm | %{
$esxcli.storage.core.device.list($rdm.ScsiCanonicalName) |
Select @{N="Time";E={"{0:g}" -f (Get-Date).TimeOfDay}},Device,IsPerenniallyReserved#
$esxcli.storage.core.device.setconfig($false,$rdm.ScsiCanonicalName,$true)
$esxcli.storage.core.device.list($rdm.ScsiCanonicalName) |
Select @{N="Time";E={"{0:g}" -f (Get-Date).TimeOfDay}},Device,IsPerenniallyReserved
}
}
Any help would be appreciated!
Thanks,