Archive | March 2018

Set Hyper-V VM Resynchronization Schedule via PowerShell

We were recently working through a multi-site Hyper-V VDI deployment for a customer and needed to set the Hyper-V replica ReSync Schedule for all VM’s and ensure that Auto Resync was enabled.  Per Host, this was accomplished by running the following script:

get-vm | Where-Object ReplicationMode -EQ “Primary” | Set-VMReplication -AutoResynchronizeEnabled $True -AutoResynchronizeIntervalStart “00:00:00” -AutoResynchronizeIntervalEnd “23:59:59”

 

For all VM’s, we used the following script:

$HVHOSTS = Get-ADComputer -Filter {Name -like “*host*” -and Name -notlike “*hvhost*”} | Select -ExpandProperty Name #NOTE: Your filter will look different , adjust to suit
foreach ($HVHOST in $HVHOSTS){
$VMs = get-vm -ComputerName $HVHOST | Where-Object ReplicationMode -eq “Primary”
foreach ($VM in $VMs){

Set-VMReplication -ComputerName $HVHOST -VMName $VM.Name -AutoResynchronizeEnabled $True -AutoResynchronizeIntervalStart “00:00:00” -AutoResynchronizeIntervalEnd “23:59:59”

}

}

Disclaimer: As with any script – please review & lab test in your own environment, before rolling out to production! 🙂

Updates!

I figured after almost a year of no posts, is was about time I added something!  It’s been a busy year, which has seen our business expand, our team increase in size and has seen us working through some really cool projects.  I’ll try and get a few more posts up here but in the meantime, please check our website over at http://www.synergytech.co.nz.  Watch this space!