Hi Everyone,
I would like to create a report to email the replication status. But I can’t align the results on the table, the 2nd command creates new columns.
The command both have PSComputerName, so I want to align them if they have the same PSComputerName. I’m still new to PS scripting and I wanna know if there’s a better way to do this like new custom object?
Invoke-Command -ComputerName ("Server1","Server2","Server3") -ScriptBlock { (Get-SRPartnership | select SourceComputerName, SourceRGName, DestinationComputerName, DestinationRGName)} | Sort-Object PSComputerName | Export-CSV -Path "C:\SRPReport.csv" -NoTypeInformation
Invoke-Command -ComputerName ("Server1","Server2","Server3") -ScriptBlock { (Get-SRGroup | select IsSuspended, ReplicationMode, ReplicationStatus)} | Sort-Object PSComputerName | Export-CSV -Path "C:\SRGReport.csv" -NoTypeInformation
Below is a snip of ps1 for emailing the results of the two generated csv.
$csv = Import-Csv $output | Select "SourceComputerName", "SourceRGName", "DestinationComputerName", "DestinationRGName", "IsSuspended", "ReplicationMode", "ReplicationStatus" | ConvertTo-Html -head $a -Body "<H2>Storage Replica Status of File Servers</H2>"
Thanks in Advance.
Regards,
Kent