Script Dumpster: Reporting all files on ESX Datastores

The Problem

I had a customer who was complaining that the simple overview of disks used by VM’s didn’t add up to the amount of data in use on datastores.
Simple reasoning being swap files, snapshots etc. etc. , but the customer wanted to see exactly what was causing this…

In comes PowerCLI [VMWare’s adaption of PowerShell for their solutions]

The Script

Edit: As I had thought at first instance, the datacenter name was working just fine on my 2 test environments, but in a 3rd I quickly ran into an error.

I’ve now adapted the script to automatically check all available DataCenters and underlying DataStores 🙂

If required you can simply export the outcome using

Happy Scripting! 🙂