PowerCLI script to Set Perennial reservation on RDM LUNs in a Cluster

Please find the Powercli script for configuring Perennial reservation on all RDM luns in a ESXi Cluster. Please change the value for following variables before you execute the script.

$vcenter = “vCenter.vmtest.com”
$dCenter = “123456”
$cluster = “Production Hypervisor”

This is the flow of script execution.

1. Get the list of RDM LUNs from the cluster.
2. Check the current perennial reservation status of the RDM. If it’s TRUE, no changes will be applied.
3. If the status is FALSE, the perennial reservation will be set on the LUN.
4. Script will query the latest status and the status will be displayed.

The result, after executing the script, looks something like this.

perinnial reservation




  • jl89996g

    nice script, I’m going to test it. It always concerns me, though, when I see typo’s in the comments. It makes me wonder about accuracy in the script. I think “bellow” should be “below” in line 12

  • Imran Khan

    Is there a way that your script can avoid the VMFS datastores (excuse me for my limited knowledge but just wanted to be more careful) as they need not be set perennialy reserved = true I beleive. Though I can see you are querying only the RDM LUNS but are there any chances that this can also edit the VMFS formatted Datastores?

    • jl89996g

      There really isn’t much chance of modifying non RDMs with this script. See in line 21, the author has specified -disktype RAW, so that’s where and how the author is only pulling in RDMs not other storage. But, testing in a non-critical environment is always prudent.