This script is a work-in-progress, but has come in very handy when I am placing VMs, and their virtual disks, in our environment. Right now, the script scours the virtual environment for VMs & templates, then tracks how much space their virtual disks and swap files take up. After adding that all up, it displays (and outputs a CSV of) all of the useful information per datastore, including the “real” free space available, capacity that includes your over-allocation %, provisioned space, and normal free space. In a future (more accurate) version, I plan to also include log files, since those can actually take up significant space.
Syntax:
.\StorageCapacity.ps1 -server
Where -overallocate is the percentage by which you want to overallocate storage (if at all) & the account you run the script as must have at least Read-Only access to vCenter Server and data reader role on the virtualcenter SQL db.
(original blog post: http://bit.ly/dx8qIB)
http://virtualcurtis.blogspot.com