If you need Data Storage free space of on your Vmware infrastructure (vSphere) as a Excel format ! Solution is here. I just need this information to follow my data growth in monthly or weekly. As you all know VMware does not provide this information like performans chart.
So just install VMware PowerCLI over here then write following script in a .ps1 file and save as getdatastorestatusascsv.ps1 via notepad or other text editor. Open Vmware PowerCLI on your desktop and just run it wherever you saved. Like “.getdatastorestatusascsv.ps1”
Do not forget determine csv file path, your Virtual Center IP address or DNS name, Username and Password for connect to Virtual Center in script.
example:
Connect-VIServer -server 192.168.1.1 -protocol https -user administrator -password Pwesd42#3
Script:
Connect-VIServer -server %VCServerIPorDNSName% -protocol https -user %USERNAME% -password %PASSWORD%
$file=”c:DataStoreStatus.csv”
$GetInfoDataSt = Get-Datastore | Sort-Object Name
$DataStorages = @()
foreach ($stores in $GetInfoDataSt )
{
$stor = “” | Select-Object Name, CapacityGB, UsedGB, FreeGB, PercentUse
$stor.Name = $stores.name
$stor.CapacityGB = [math]::Round($stores.CapacityMB/1024,2)
$stor.UsedGB = [math]::Round(($stores.CapacityMB – $stores.FreeSpaceMB)/1024,2)
$stor.FreeGB = $stor.CapacityGB – $stor.UsedGB
$stor.PercentUse = [math]::Round(100*$stores.FreeSpaceMB/$stores.CapacityMB,2)
$stor.PercentUse = 100 – $stor.PercentUse
$DataStorages += $stor
}
$DataStorages | Export-csv -Path $file