Track Datastore Free Space
I’ve got a great new script for you today!
We all love VMware for consolidating our servers. And we all know that virtualization requires lot’s of SAN space. But how do you keep track of the amount of space left on all your datastores? It’s pretty easy to create a report using the Powershell VI Toolkit. But who is going to read all those reports and compare them to yesterday’s values? You will most likely end up with a mailbox full of reports and still be surprized when yet another datastore fills up.
PeetersOnline to the rescue! How about storing the report every day and comparing today’s values to yesterday’s values? Then you can email yourself only the differences. The overview shows the datastores that changed since yesterday, the change rate and the current value. This way, you can easily assess if the datastore is about to fill up.
Because it is quite a large script (in Powershell terms) and it contains long lines that are not easily readable on my site, I have attached the script for you to download. It contains lot’s of comments, so you should be able to follow exactly what it does and how it works. If not, post a comment.
Enjoy!
Hugo
11 Responses to Track Datastore Free Space
Tags
Active Directory API bind order cleanup cluster CPU Custom Fields datastores description device management directory tree errors Event Log file name filter Fun function HA IT known issues License Server LUN multipath NIC objects Oneliner portgroups PowerCLI PowerShell profile recursive Registry Scripts security session share snapshots SQL Stat VI Toolkit VMware vSphere WMI WSUS ZenArchives
- July 2012
- July 2011
- February 2011
- January 2011
- December 2010
- May 2010
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008





Good little tool, but it would also be great to export a CSV doc for reporting purposes.
just my $.02
Thanks
I want to export it to html to see it in my html reports????Please help
[...] Track Datastore Free Space [...]
[...] http://www.peetersonline.nl/index.php/vmware/track-datastore-free-space/ [...]
[...] Adattárad szabad helyeinek változásait követheed figyelemmel. Hugo Peeters http://www.peetersonline.nl/index.php/vmware/track-datastore-free-space/ [...]
Hi
Cool script.
I have done some simular. This is a webpage that shows graphs.
http://www.amikkelsen.com/?p=118
Please give your comments
Hello Guys,
very nice script!
How can i add commands for sending me an alert if datastore capacity is for an example below 10% of complete storage?
Thanks in advance.
cheers
[...] Link | Add Custom Fields to VI Client with Powershell Link | VMware Health Check Script Link | Track Datastore Free Space Link | List disk RDMS Link | Find Snapshots and Send email to User Link | Setting Video Hardware [...]
hello Hugo
many tnx for your help (how do manipule variable)
pls, i have an under gestion.
can i creat an exe file from the PS script file ?
(transportable)
tnx
arenas
That is currently not supported. Somebody is trying to build Portable Powershell. Search Google for it.
# Export the output to an xml file; the new Current file
$myColCurrent | Export-csv -Path “$Folder\$currentFile”
# Disconnect from Virtual Center
Disconnect-VIServer -Confirm:$False
# Finally, let’s compare the Current information to that in the Previous file
# Check if a Previous file exists
If (Test-Path “$Folder\$previousFile”)
{
# Import the Previous file
$myColPrevious = Import-Csv “$Folder\$previousFile”