Hi there,
we have the snippet:
$VM = "VMNAME"
$result = Get-VM $VM | Get-HardDisk |
Select-Object `
@{N="SCSI ID"; E={$strControllerKey = $_.ExtensionData.ControllerKey.ToString(); "{0}`:{1}" -f $strControllerKey[$strControllerKey.Length - 1], $_.ExtensionData.Unitnumber}},
@{N='vDisk Name'; E={$_.Name}},
@{N='vDisk Capacity'; E={$_.CapacityGB}},
@{N='Disk Type'; E={$_.DiskType}},
@{N='OS Drive Letter'; E={Get-VMGuestDisk -VM $VM | Select-Object -ExpandProperty DiskPath}}
$result | Format-Table -AutoSize
Now the Problem is that the OS Drive letter is not combined to the SCSI ID. I always get an Array with Drive Letters.
Sometimes we get requests from customers to resize disks on VMs and they give us drive letters or other stuff we cannot work with, if there are drives with the same size, so we thought it would be cool to have a script to get the job done. The problem is: we don't have the credentials for the VMs most of the time.
Can anybody give me a hint how to solve that problem?
Thanks in advance
regards
Susie