Q: I'm trying to use Windows PowerShell to enable aHyper-V host to be Live Migration-enabled by setting the VirtualMachineMigrationEnabled attribute to $true--so why am I getting an error?
A: If a host is enabled for Live Migration, then its VirtualMachineMigrationEnabled attribute is set to true, for example:
However, if you actually try and enable Live Migration by setting this value, you will get an error message saying that this attribute is read-only:
'VirtualMachineMigrationEnabled' is a ReadOnly property.
At line:1 char:1
+ (Get-VMHost savdalhv01).VirtualMachineMigrationEnabled = $true
+ CategoryInfo : InvalidOperation: (:) , RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
To enable Live Migration you actually need to use the Enable-VMMigration cmdlet. Also remember you might want to also set the networks that can be used for Live Migration by using the Set-VMMigrationNetwork cmdlet. And you might also want to set the authentication method with the Set-VMHost -VirtualMachineMigrationAuthenticationType. For example:
PS C:\> Set-VMMigrationNetwork 10.1.2.1
PS C:\> Set-VMHost -VirtualMachineMigrationAuthenticationType Kerberos