VMware Cloud Community
tsentekin
Contributor
Contributor

get lunID of a RDM Disk

hi everyone,

i'm now using this one to list the RDM's

$report = @()
$vms = Get-VM | Get-View
foreach($vm in $vms){
  foreach($dev in $vm.Config.Hardware.Device){
    if(($dev.gettype()).Name -eq "VirtualDisk"){
       if($dev.Backing.CompatibilityMode -eq "physicalMode"){
         $row = "" | select VMName, HDDeviceName, HDFileName
          $row.VMName = $vm.Name
         $row.HDDeviceName = $dev.Backing.DeviceName
         $row.HDFileName = $dev.Backing.FileName
         $report += $row
       }
     }
  }
}
$report | Export-Csv c:\rdm.csv

this lists the RDM devices "ClusterName","LunName","LunUuid","Lunsize","VolumeName"  but but what i really need is the mapping id of the lun given from the shared storage device (NetApp) which i can see in the hba devices paths in vsphere. and after that i want to add the RDM disk with the particular Lun ID to a Vm.

This is very important for me so i appreciate any help on this.

Thanks Alot.

Reply
0 Kudos
3 Replies
a_p_
Leadership
Leadership

LucD
Leadership
Leadership

You could try the script from my yadr – A vdisk reporter post


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

Reply
0 Kudos
tsentekin
Contributor
Contributor

Thanks André,

this really will help me,

the script in the link gives me a lunID of the RDM disk which is already mapped to a Vm, i'm trying to manipulate it to a shape where i can list all the RDM LunID's of the luns connected to vsphere whether it's connected to a Vm or not. and i'm not succesfull as of now:((

i'm still trying to learn vspherecli and powershell same time.

i can still ask for assistance if you don't mind:)

Best.

Tolga

Reply
0 Kudos