VMware Cloud Community
ewannema
Enthusiast
Enthusiast

Map a VM logical disk to a vmdk

I am trying to automate some VCB actions and I want to find out which vmdk hosts a particular Windows logical drive. I can grab a lot of info from WMI, but I can't seem to figure out a way to reliably determine the controller # if there are multiple scsi controllers.

I tried to go about it from the VI SDK side and I can see the disks under (Get-VIew $myvm.ID).guest.disk but I don't see a way to map that to the VMDK. Has anyone here done this or have a pointer for me?

http://wannemacher.us
0 Kudos
3 Replies
hugopeeters
Hot Shot
Hot Shot

I solved that puzzle for my Disk Usage script. Check it out here.

Hugo

PeetersOnline.nl

0 Kudos
ewannema
Enthusiast
Enthusiast

Nice script. In some experimental testing I did it seems that the SCSIPort gets assigned sequentially. It works if you have SCSI controllers 0 and 1, but it seems to break if I did 0 and 3.

Also, I found the WP-Syntax plugin to be very nice for syntax highlighting on my Wordress blog. You can surround the code with <pre language="Powershell"> </pre> and the highlighting/indenting is pretty good.

http://wannemacher.us
0 Kudos
olan025
Enthusiast
Enthusiast

You can try this script i built for my place.

We're heavy on RDMs so I emphasize getting the UUIDs as well....

But the WinDiskNum translates to the Windows Disk Number in Disk Management on the grey box saying "Disk 1" etc.

So you should be able to see Disk 1 and then the VMDK.

Let me know if that works

0 Kudos