Scenario:
You are using Hyper-V replica as a part of a DR solution and you really need to know if it works correctly
Solution:
This will display that information in varies shapes and formats
Display on screen in text
Get-VM | Where-Object -Property ReplicationMode -EQ -Value Replica | Get-VMReplication
Get-VM | Where-Object -Property ReplicationMode -EQ -Value Replica | Get-VMReplication | Select Name,State,Health,PrimaryServer | Format-Table
Display using the gridview
Get-VM | Where-Object -Property ReplicationMode -EQ -Value Replica | Get-VMReplication | Out-GridView
Get-VM | Where-Object -Property ReplicationMode -EQ -Value Replica | Get-VMReplication | Select Name,State,Health,PrimaryServer | Out-GridView
Display using HTML
Get-VM | Where-Object -Property ReplicationMode -EQ -Value Replica | Get-VMReplication | ConvertTo-Html -title "Hyper-V Replica Status: $ENV:COMPUTERNAME" -body (get-date) -pre "<P>Generated by Corporate IT</P>" -post "For details, contact Corporate IT." > $ENV:TEMP\replicastatus.htm; Invoke-Item $ENV:TEMP\replicastatus.htm
Get-VM | Where-Object -Property ReplicationMode -EQ -Value Replica | Get-VMReplication | Select Name,State,Health,PrimaryServer | ConvertTo-Html -title "Hyper-V Replica Status: $ENV:COMPUTERNAME" -body (get-date) -pre "<H1>Replica Status for Host: $ENV:COMPUTERNAME </H1><P>Generated by Corporate IT</P>" -post "<P>For details, contact Corporate IT.</P>" > $ENV:TEMP\replicastatus.htm; Invoke-Item $ENV:TEMP\replicastatus.htm
/mike
Categories: Hyper-V, PowerShell, Windows Server 2012