Compare the luns present on hosts in a cluster

But two node cluster it is very easy to compare the lun number and lun name. However in production there won’t be less than 3 cluster. For two node cluster, below is the command

Compare-Object -ReferenceObject $(Get-Datastore -VMHost -differenceObject $(Get-Datastore -VMHost -IncludeEqual | Format-Table –AutoSize


For multiple node, you need some thing more advance that what i was able to do. But to make it simple here is the out and see the code below



$Cluster=get-cluster -name ESXi-Cluster | get-vmhost
foreach($hosts in $Cluster){
get-datastore -vmhost $ | sort name | format-table -autosize
$A=get-datastore -vmhost $
Write-host "*********** $ Lun Count ($B)*************" -foreground Yellow


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s