VMware Cloud Community
swspjcd
Enthusiast
Enthusiast
Jump to solution

list VMs and their total disk space allocated?

Anyone have simple script that can make a list of all VMs and total the amount of disk space allocated by each one, preferably including snapshot size if one exists. I'm not as concerned about white space per drive. I'd just like to see what VMs are using the most space by totalling space allocated of each VM.

Thanks. Still trying to learn powershell when I can find the time!

0 Kudos
1 Solution

Accepted Solutions
cknox
Contributor
Contributor
Jump to solution

Here you go. This was a rough draft that we created last week. It will give up to 3 VMDK's for each VM in an excel workbook. Change the vc_server var. Hope it helps.

View solution in original post

0 Kudos
12 Replies
LucD
Leadership
Leadership
Jump to solution

Have a look at .

It doesn't do exactly what you ask for but if you create your guest in a "standard way" it shows you the size of your guest (snapshots included).

With the "standard way" I mean:

- guest folder on level 1 of the datastore

- virtual disk(s) stored with the guest

- swap file stored with the guest


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

cknox
Contributor
Contributor
Jump to solution

Here you go. This was a rough draft that we created last week. It will give up to 3 VMDK's for each VM in an excel workbook. Change the vc_server var. Hope it helps.

0 Kudos
MWinkenbach
Contributor
Contributor
Jump to solution

Hi cknox,

your script is nearly perfekt for me, thanx this way !!!!

But one question still on... how is it possible to list the snapshots (name, creation date, allocated space) to every VM ?

Greets,

Michael

0 Kudos
Zsoldier
Expert
Expert
Jump to solution

Easiest way is to use the get-snapshot cmdlet.

get-vm | get-snapshot

Chris Nakagaki (中垣浩一)
Blog: https://tech.zsoldier.com
Twitter: @zsoldier
0 Kudos
MWinkenbach
Contributor
Contributor
Jump to solution

I know,

but i was not able to implement it in the script (shame on me.....:()

Maybe you can give me a hint....

Greets,

Michael

0 Kudos
Zsoldier
Expert
Expert
Jump to solution

I'm fairly lazy so I would just export to a csv file.

get-vm | get-snapshot | export-csv -path C:\temp\snapshot.csv

Chris Nakagaki (中垣浩一)
Blog: https://tech.zsoldier.com
Twitter: @zsoldier
0 Kudos
MWinkenbach
Contributor
Contributor
Jump to solution

My Problem still exist...

What i need is the allocated space for each Snapshot!!!

With the script from cknox, i get all Harddisks form the VM´s. and like the

allocated space from the HD´s i need the allocated space for each Snapshot.

So what i really look for is a hint how i can manage to get all Informations in one xls or cvs...

0 Kudos
gboskin
Enthusiast
Enthusiast
Jump to solution

The attached script puts all the information in one HTML document..

Rob tool www.robware.net is also very usefull...

Cheers

0 Kudos
bggb29
Expert
Expert
Jump to solution

Hi

This script works very well. I do have a question there are 2 columns that the script builds owner and dept.

Where does it pull this information from. How can I add that to my vc so the spreadsheet will populate

those 2 pieces of information.

thanks

0 Kudos
gboskin
Enthusiast
Enthusiast
Jump to solution

Is this directed @ the script I attached??

0 Kudos
Zsoldier
Expert
Expert
Jump to solution

Nice script. Thanks for posting.

Chris Nakagaki (中垣浩一)
Blog: https://tech.zsoldier.com
Twitter: @zsoldier
0 Kudos
bggb29
Expert
Expert
Jump to solution

Yes the script you attached. Where the 2 fields added note and annotations to virtual center to read from.

Or are they just the 2 lines in the script that add the fields to the spreadsheet

thanks

0 Kudos