HPE Storage Tech Insiders
Showing results for 
Search instead for 
Did you mean: 

VMware Space Reclamation - On All Datastores


Reclaiming space in VMware is an annoying thing.

But with a little help from VMware's community it can be a much simpler process.

I saw a recent comment in an old Thread and thought it would be a good idea to finally post this.

I found the attached script here: https://communities.vmware.com/message/2437373

Here's what the script does after you pointed it to vCenter:

1) Get a list of all datastores and loop through them.

2) Find out how much space is free and calculate 0,5% of that.

    This is something you can tune in line 144. (I've never touched it)

[decimal]$freeDSSpace = $ds.FreeSpaceMB

$unmapSize = [MATH]::round($freeDSSpace*.005)

3) Run the vmfs unmap

I've been using this Script for the past year and gave it to most of my customer.

Never saw any problems with it.

Have fun!


About the Author


See posts for
HPE at 2018 Technology Events
Learn about the technology events where Hewlett Packard Enterprise will have a presence in 2018.
Read more
See posts for dates/locations
Reimagine 2018
Join us at one of the Reimagine 2018 stops and see how we Simplify Hybrid IT, innovate at the Intelligent Edge and bring it all together with HPE Poin...
Read more
View all