Hello,
I'm looking for a storage report encompassing my entire vcenter. I want datastores, but also anything not in a datastore, like RDMs or storage which has not been used or defined as a DS. I want ESX host installation boot drives, and everything. I figured that this would require pulling from each ESXi host but then I would get duplicates. I want Total Space, Used Space, Free Space. Kind of what is in the Summary tab for vCenter, but not just datastores. Not sure if a foreach loop would be necessary.
I tried using Bing, but there is no -ViewType called StorageDevice:
$storageDevices = Get-View -ViewType StorageDevice | Select-Object -ExpandProperty ScsiLun $totalCapacity = ($storageDevices.Capacity.Block * $storageDevices.Count / 1TB) $totalUsed = ($storageDevices.Capacity.Block - $storageDevices.FreeSpace.Block * $storageDevices.Count) / 1TB $totalFree = ($storageDevices.FreeSpace.Block * $storageDevices.Count / 1TB) Write-Host "Total Capacity: $totalCapacity TB" Write-Host "Total Used: $totalUsed TB" Write-Host "Total Free: $totalFree TB"
Any help would be appreciated.
You might want to have a look at my LUN report – datastore, RDM and node visibility post.
Besides the ESXi boot drives, I think most of the info you are after is there.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD,
I get the error:
Add-Type : Cannot add type due to the following exception: Compiler executable file csc.exe cannot be found.. Verify
that Microsoft .NET Framework 3.5 is installed. On x64-based versions of Windows, you must also install the WOW64
feature.
Also, I simply need totals, not what's missing, if that simplifies my request.
Thanks again.
Strange, which .Net version do you have installed?
Not sure where you got that snippet from, I have no idea where this $StorageDevice object is coming from.
Nor do I understand which "totals" you are after.
Does that include all storage types (VMFS, iSCSI, NFS, USB, ...)?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I am looking for all VMDK, NFS, RDM and SAN FC presented LUNs (in case the LUN was presented but a datastore was not created). My understanding that if I click on my vCenter in the Inventory screen (Hosts & Clusters) and go to the Summary tab, this only includes datastores, but I want everything presented to vC. (We have no USB here.)
The snippet came from a Bing AI search, which I was hoping I could build upon. But the Get-View is wrong.
