The Deployment Bunny

OS Deployment, Virtualization, Microsoft based Infrastructure…

  • Archives

  • Meta

PowerShell is King–Does my VM’s replicate correct, I need a report.

Posted by Mikael Nystrom on January 16, 2013

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

image

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

image

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

image

/mike

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

 
%d bloggers like this: