VMware Cloud Community
SixShooterz
Contributor
Contributor

Script to get disk information..

I've been tasked with getting the following information and compiling it into a report management can understand.  Ideally, I'd like a report formatted as follows:

VM NameDisk1 Drive LetterDisk1 Provisioned SpaceDisk1 Current VMDK SizeDisk1 Guest Reported Used SpaceDisk1 Space Difference

We use thin provisioning on all of our VMs and I'm trying to recover some space via Storage vMotion and don't want to move all VMs, only those w/ wasted space.  I need it to report all drive letters.

I've tried all of the scripts I can find that report similar information and all seem to be missing one of the above values and I'm not familiar enough with scripting to modify it to my needs or add the missing info.

So far, it seemes the one from Hugo covers all the info I need, located here.  It's missing the DiskFileSizeGB object and when I try to add it as suggested in the comments, it returns the following (after a long scan):

===============================

===============================

Total DS Free:

Total DS Size:

Average DS Free Percentage:

Average Disk Free Percentage:

The CSV file that I have it outputting to comes up blank as well.  I've attached the exact version of the script, modified to my environment.

I've also tried YADR from LucD and it doesn't include the guest OS info. (I've removed the snapshot bits from the script for my purposes as they're not currently needed).  Any help would be greatly appreciated!

EDIT:  The most recent run returned:

Capture.PNG

Message was edited by: SixShooterz

0 Kudos
1 Reply
LucD
Leadership
Leadership

The best solution to get the vDisk vs guest OS disk mapping, provided you have Wndows running in your guests, is teh WMI method described in Arnim's PowerCLI: Match VM and Windows harddisks – Part 2 post.

There is a improved version of that script available as function Get-VMDiskMapping, in the book.


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

0 Kudos