VMware PowerCLI – Adding RDM Disk’s

David Ring

See also: VMware PowerCLI – Adding VMFS Datastore’s

After creating the required LUN’s on your storage array and mapped the LUN’s to your ESXi hosts then you may use PowerCLI to add these new LUNs as RDM Disk’s to a Virtual Machine.

The first four steps outline how to use PowerCLI to add an individual RDM to a Virtual Machine and the second section provides the script to add multiple RDM volumes to a Virtual Machine(s).

1. Connect to vCenter:
Connect-VIServer -Server “vCenter_IP” -User UserName -Password Password

If you need to retreive the Cluster and Host names:
look up the Cluster Name:
Get-Cluster
look up the Host names in the cluster:
Get-Cluster ‘Cluster Name’ | Get-VMHost | Select Name

2. Retrieve the ConsoleDeviceName(s):
In order to use the New-HardDisk cmdlet we require the ‘ConsoleDeviceName’ parameter associated with each LUN. In this example we will use the Get-SCSILun cmd to return…

View original post 620 more words