PowerCLI Script – Report datastore free space Percentage

I hope we are all busy with evaluating vSphere 6.5 and its cool new features. Let me take short break from vSphere 6.5 and will write article about PowerCLI script to Report of  datastore free space Percentage . In most of the vSphere enterprise environment, They would have set an standard datastore free space Percentage that should always be maintained across all datastore as enterprise standard. I would always recommend 10% to 20 %  free space should always be kept free to accommodate VM operations such as Snapshots, Memory Increase which needs swap space in datastore and also for best practices. You may be having hundred’s to thousands of datatstores in your virtualized infrastructure.  Manually validating all datastores Free space percentage is painfull. This powercli script helps you to get the report of datastores along with free space Percentage. This helps you to quickly address the datastore which is having less free datastore space as per your organization standard.

PowerCLI Script – Report datastore free space Percentage


How to Execute the Script?

Copy and Paste the above Script and save it in the Notepad. Name the script as “DataStoreFreeSpace-Percentage.ps1″

  1. Execute the Script in PowerCLI “.\DataStoreFreeSpace-Percentage.ps1
  2. Input  vCenter Server Name to execute the script to get the report free space Percentage of datastore
  3. Enter the Username with administrative credentials on vCenter Server
  4. Enter the password for the above entered Username
  5. Hit Enter to execute the script and pull the report.

free space Percentage of datastore

Script Output

Datastore free space Percentage report will be exported and saved in the Microsoft Excel output file with the filename “DataStoreInfo_Today_Day-time.CSV”  under the same directory where the PowerCLI Script “DataStoreFreeSpace-Percentage.ps1”  is located.

datastore free space Percentage

I hope script will be useful for you to get the datastore free space percentage to monitor the space usage of your datastores. Thanks for Reading !!! Be social and share it in social media, if you feel worth sharing it.