PowerCLI – List VMs with RDM

0

In today’s we will look at how to list VMs with RDM using PowerCLI. The idea behind the article came to my mind when I was working with one of the users.

The customer wanted to perform a SAN to SAN migration and there were a lot of Virtual Machines with RDMs configured.

I first performed a Google search and could find a few scripts available but most of them were lengthy and cumbersome.

I was looking at probably a one-liner which would list the Virtual Machine name along with the RDM details.

The one-liner that I wrote will list the below details:

  • Virtual Machine Name.
  • Hard Disk Name.
  • Disk Type (Physical or Virtual compatibility).
  • LUN ID of the device.
  • VML ID of the device.
  • VMDK File name.
  • The size of the RDM LUN.

Before you run this command, kindly connect to the vCenter Server or the ESXi host using the Connect-VIServer cmdlet.

Get-VM | Get-HardDisk | Where-Object {$_.DiskType -like “Raw*”} | Select @{N=”VMName”;E={$_.Parent}},Name,DiskType,@{N=”LUN_ID”;E={$_.ScsiCanonicalName}},@{N=”VML_ID”;E={$_.DeviceName}},Filename,CapacityGB | Export-Csv C:\Users\Adil\Desktop\RDM-list.csv -NoTypeInformation

The output of the CSV file will look something like below.

PowerCLI - List VMs with RDM

I hope this has informative and thank you for reading!

Share.

About Author

I am Adil Arif, working as a Technical Support Engineer at VMware as well as an independent blogger and founder of Enterprise Daddy. In my current role, I am supporting infrastructure related to Windows and VMware datacenters.

Leave A Reply

LIKE WHAT YOU'VE READ?
If so, please join the community.  I’d love to send you exclusive content right to your email, and I’ll send you a free copy of my book, VMware vSphere 6.0 Lab on Workstation too!
Enter your name and email below, and I’ll see you on the inside!

SUBSCRIBE