PowerShell, Hyper-V, SCVMM: Bulk repair VM's

VM's can show as failed in SCVMM for a multitude of tedious and annoying reasons. It's one of the many reasons why I really don't like it, and when a VM is showing as failed you better belief SCVMM isn't going to migrate it or power it on or any of the "useful" things that you need it for.

This is a quick script to repair all VM's in your cluster that are showing as failed due to a migration issue.

$fixvm = Get-SCVirtualMachine | Where-Object -FilterScript {$_.status -like "MigrationFailed"} 

foreach ($fixv in $fixvm)
    Repair-SCVirtualMachine -vm  $fixv -Dismiss