$vmName='TESTVM'
function enableCpuCompatibility($vmName){
$compatibilityForMigration=(Get-VMProcessor $vmName).CompatibilityForMigrationEnabled
if(!$compatibilityForMigration){
$vmIsRunning=(get-vm $vmname).State -eq 'Running'
if($vmIsRunning){stop-vm $vmName}
Set-VMProcessor$vmName -CompatibilityForMigrationEnabled 1
if($vmIsRunning){start-vm $vmName}
}else{
write-host "$vmName already has CPU CompatibilityForMigrationEnabled set to True"
}
}
enableCpuCompatibility $vmName
Categories: