Total Storage Available for Cluster

This post was originally published on this site

Hi All,

 

I’m trying to retrieve the Total storage available for all Cluster available in the vCenter. Below script retrieve only for one cluster i.e. Cluster1.

I need help to retrieve the Total Storage and available storage value for all the cluster instead of one specific “Cluster 1” value. is it possible to retrieve for all the Cluster in vCenter from Power Cli ?

 

Import-Module VMware.VimAutomation.Core

Connect-VIServer -Server 10.1x.y.z -user "mydomainusername"

 

$date = Get-Date

 

$datastore = Get-Cluster -Name Cluster1 | Get-Datastore | Where-Object {$_.Type -eq 'VMFS' -and $_.Extensiondata.Summary.MultipleHostAccess}

 

$TotalStorage = ($datastore | Measure-Object -Property CapacityMB -Sum).Sum / 1024

$AvailableStorage = ($datastore | Measure-Object -Property FreeSpaceMB -Sum).Sum / 1024

 

$endpoint = "https://api.powerbi.com/beta/83fe1fa2-fa52-4376-b7f0-cb645a5fcfced/datasets/d57970bc-60b3-46e6-b23b-d782431a72be/rows?key=2zEhgN9mu%2BEH%2FI2Cbk9hd2Kw4b5c84YaO6W8gzFcZbBnO6rti3N631Gjw%2FveNXSBxwR84VcWPGOSrheNwQnCbw%3D%3D"

$payload = @{

"Date" = $Date

"Total Storage" = $TotalStorage

"Available Storage" = $AvailableStorage

}

Invoke-RestMethod -Method Post -Uri "$endpoint" -Body (ConvertTo-Json @($payload))

 

Disconnect-VIServer * -Confirm:$false

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.