Automation

 View Only
Expand all | Collapse all

How do I get Disk Vendor details in the output

  • 1.  How do I get Disk Vendor details in the output

    Posted Nov 08, 2021 12:24 PM

    How do I get Disk Vendor details in the output. Please help.

    $DiskInfo= @()
    foreach ($VMview in Get-VM MyVM1 | Get-View){
    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 VMname, SCSIController, DiskName, SCSI_ID, DeviceName, DiskFile, DiskSize
    $VirtualDisk.VMname = $VMview.Name
    $VirtualDisk.SCSIController = $VirtualSCSIController.DeviceInfo.Label
    $VirtualDisk.DiskName = $VirtualDiskDevice.DeviceInfo.Label
    $VirtualDisk.SCSI_ID = "$($VirtualSCSIController.BusNumber) : $($VirtualDiskDevice.UnitNumber)"
    $VirtualDisk.DeviceName = $VirtualDiskDevice.Backing.DeviceName.Where{$_ -ne ''} | %{$_.Substring(22,24).ToUpper()}
    $VirtualDisk.DiskFile = $VirtualDiskDevice.Backing.FileName
    $VirtualDisk.DiskSize = $VirtualDiskDevice.CapacityInKB * 1KB / 1GB
    $DiskInfo += $VirtualDisk
    }}}
    $DiskInfo



  • 2.  RE: How do I get Disk Vendor details in the output
    Best Answer

    Posted Nov 08, 2021 12:47 PM

    Something like this



  • 3.  RE: How do I get Disk Vendor details in the output

    Posted Nov 08, 2021 12:52 PM

    Thank you very much. that worked perfectly