Posted On September 30, 2020

Hyper-V Set CompatibilityForMigrationEnabled

kimconnect 0 comments
blog.KimConnect.com >> Codes , Virtualization >> Hyper-V Set CompatibilityForMigrationEnabled
$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

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

PowerShell: Enable Remote Desktop

$computernames=@' SERVER1 SERVER2 '@ $computers=@($computernames -split "`n" -replace "\..*$") function enableRemoteDesktop{ $regHiveTs='HKLM:\System\CurrentControlSet\Control\Terminal Server' $regKeyTs='fDenyTSConnections' $enable=0…

How to Obtain Mac Address of Remote Computer

# PowerShell $computername='TESTSERVER' Get-CimInstance -ClassName Win32_NetworkAdapterConfiguration -Filter "IPEnabled='True'" -ComputerName $computername|Select-Object -Property MACAddress, Description # Sample…

Enable WinRM Remotely

Usage:enableWinRm 'RemoteServer' get-credential $remoteComputer='REMOTESERVER' $winRmPort=5985 $adminCredential=get-credential function enableWinRm($remoteComputer,$winRmPort=5985,$adminCredential){ function Check-NetConnection($computername,$port,$timeout=200,$verbose=$false) { $tcp = New-Object System.Net.Sockets.TcpClient;…