I have the below code:
$clusters=“pcclus4”, “pctclus7”
$VMS=@()
Foreach($cluster in $clusters)
{
$VMS += Get-VM –ComputerName (Get-ClusterNode –Cluster $cluster) |Where-Object { $.Name -like ‘FS’ }
$NoReplica=$VMS |where-object {$.ReplicationState -eq “disabled”} |ft Name | Out-String
$text= “Servers without replica enabled in cluster $clusters are” + “`r`n” + $NoReplica
}
Send-MailMessage -To “lala@lala.com” -From “cluster@lala.com” -Subject “FS without Hyper-V Replica Enabled” -SmtpServer “lalamail.lala.com” -Body $text
I am getting a report on email looking like
HostName Name
-------- ---- tFS11 PC3FS21 PCADFS21 tFS16 PC7FS22
This output contains the FS from both clusters. I would like to get a report formatted on a table or at least to have the name of the cluster and then the FS then the other cluster and its FS below. For e.g.
FS on pcclus4
tFS11 PC3FS21
FS on pctclus7
PCADFS21 tFS16 PC7FS22