2 Replies Latest reply on May 27, 2019 3:46 AM by ganapa2000

    issue getting only RDM details

    ganapa2000 Hot Shot



      I am unable to get only RDM details from the below script as I am getting flatdisks along with RDMs.


      Please help....


      $vmview = Get-View (Get-VM -name MyDB1).ID

      $DiskInfo= @()


      foreach ($VirtualSCSIController in ($VMView.Config.Hardware.Device | where {$_.DeviceInfo.Label -match "SCSI Controller"}))


      foreach ($VirtualDiskDevice in ($VMView.Config.Hardware.Device | where {$_.ControllerKey -eq $VirtualSCSIController.Key}))


      #$VirtualDisk = "" | Select VM, SCSIController, DiskName, DiskType, SCSIId, DiskFile, DiskSize

      $VirtualDisk = "" | Select VM, Disk_Name, SCSI_Control, SCSI_ID, Disk_File, Disk_Size, Disk_Type

      $VirtualDisk.VM = $vmview.name

      $VirtualDisk.SCSI_Control = $VirtualSCSIController.DeviceInfo.Label

      $VirtualDisk.Disk_Name = $VirtualDiskDevice.DeviceInfo.Label

      $VirtualDisk.Disk_Type = $VirtualDiskDevice.backing

      $VirtualDisk.SCSI_ID = $VirtualDiskDevice.UnitNumber

      $VirtualDisk.Disk_File = $VirtualDiskDevice.Backing.FileName

      $VirtualDisk.Disk_Size = $VirtualDiskDevice.CapacityInKB * 1KB / 1GB


      $DiskInfo += $VirtualDisk




      $DiskInfo | export-csv -Path $out_csvpath -Delimiter "," -NoTypeInformation





      MyDB1Hard disk 1SCSI controller 00[FAS01B_LUN01] MyDB1/MyDB1.vmdk40VMware.Vim.VirtualDiskFlatVer2BackingInfo
      MyDB1Hard disk 2SCSI controller 01[FAS01B_LUN01] MyDB1/MyDB2.vmdk50VMware.Vim.VirtualDiskFlatVer2BackingInfo
      MyDB1Hard disk 3SCSI controller 10[FAS01B_LUN01] MyDB1/MyDB1_1.vmdk1VMware.Vim.VirtualDiskRawDiskMappingVer1BackingInfo
      MyDB1Hard disk 4SCSI controller 11[FAS01B_LUN01] MyDB1/MyDB1_2.vmdk100VMware.Vim.VirtualDiskRawDiskMappingVer1BackingInfo