I can successfully search a datastore for all .vmdk files using the following:
dir vmstore:\ha-datacenter\MyDatastore\ -Recurse -Include *.vmdk
This returns the vmdk file size in bytes and the conversion is straightforward once I dump the results out to CSV.
What it doesn't tell me is the used space of that VMDK. This is something I can obtain by using Get-VM VMName | Select UsedSpaceGB. However, in order to do this, the VM obviously needs to be added to the inventory.
I have several hundred VMDK's spread across multiple datastores that are not in the inventory.
Is there a method I could use to obtain the following:
- Search all datastores for .VMDK files
- Display the used space of the VMDK
- Display the LastWriteTime of the VMDK
- Display the full folder path of the VMDK.
- Dump it all out into a CSV
If I use the vSphere client, I can browse the datastore and the data I need is there, it is displayed as 'Size' and 'ProvisionedSize', however doing this for several hundred files would probably take me weeks and is not practical :smileyblush:
Any help would be appreciated