VMware Cloud Community
Sivan09
Contributor
Contributor
Jump to solution

How cli script for identifying RDM's

Hi

I am looking for powercli script to identify which vmguest has RDM's attach to it and with LUN ID. Can you please help me how to execute that.

Thanks,

Siva.

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Have a look at my yadr – A vdisk reporter post.

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

Have a look at my yadr – A vdisk reporter post.

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
ykalchev
VMware Employee
VMware Employee
Jump to solution

Hi,

You can also start with this simple script

$report = @()
 Get-VM | % {
  $row = "" | select vm,  ScsiCanonicalName, DeviceName 
  $row.vm = $_.Name
  $hdd = $_ | Get-HardDisk | where { $_.DiskType -like "Raw" }  
  $row.ScsiCanonicalName = $hdd.ScsiCanonicalName
  $row.DeviceName= $hdd.DeviceName
  $report += $row
}

$report

Regards,

Yasen

Yasen Kalchev, vSM Dev Team
0 Kudos
RvdNieuwendijk
Leadership
Leadership
Jump to solution

With PowerCLI 4.1 you can do this in a oneliner:

Get-VM | Get-HardDisk | Where-Object { $_.DiskType -like "Raw*"} | `
  Select-Object -property @{N="VM";E={$_.Parent}},DiskType,Name,ScsiCanonicalName,DeviceName

Regards, Robert

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
0 Kudos
naamancampbell1
Contributor
Contributor
Jump to solution

I changed the 1-liner above to dump all the info for each RDM:

Get-VM | Get-HardDisk | Where-Object { $_.DiskType -like "Raw*"} | Format-List

0 Kudos