Quantcast
Channel: VMware Communities : All Content - VMware PowerCLI
Viewing all articles
Browse latest Browse all 16717

Script to get infomration of datastore per cluster

$
0
0

Hi All,

 

Good Morning!

 

I am trying to write a script to get all datastore in the cluster and it should give me the data in table format like datastorename, clustername,capacityGB, freespaceGB,usedspace=freespaceGB/capacityGB *100

 

#$VCName = Read-Host "Enter the VC name "

Connect-VIServer VCname -WarningAction Continue

clear

$cls = get-cluster

Get-Datastore|where {$_.name -notlike "*local*" -and $_.name -notlike "*template*"}| Format-Table name ,capacityGB, freespaceGB -AutoSize

 

the above get-datastore cmd is giving me the list of all the datastore and capacityGB, freespaceGB but not the cluster name. I tried for loop as well but not getting the desired result.

 

Can someone correct my script above.


Viewing all articles
Browse latest Browse all 16717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>