SetProcessorCompatibility.ps1

Letzte Aktualisierung: August 2009

Betrifft: Virtual Machine Manager 2008 R2, Virtual Machine Manager 2008 R2 SP1

To improve compatibility between hosts with different processor versions and virtual machines running older operating systems, you can configure options that limit the processor functionality of a virtual machine. You can use one of the following parameters with the Set-VM cmdlet to match the CPU settings for a virtual machine to the actual processor hardware on a host during placement or migration.

  • LimitCPUForMigration

    This parameter is new in System Center Virtual Machine Manager (VMM) 2008 R2. It limits the processor features that the virtual machine can use on a host that is running Windows Server 2008 R2. This allows you to migrate the virtual machine to physical computers with different processor versions. However, migrating virtual machines between physical computers with processors from different manufacturers is not supported.

  • LimitCPUFunctionality

    This parameter enables running an older operating system (such as Windows NT 4.0) on a virtual machine deployed on a Hyper-V host by providing only limited CPU functionality for the virtual machine.

The following script prompts the user for the name of a virtual machine and for the compatibility option to update. It then stops the specified virtual machine and updates the requested compatibility option.

Disclaimer

# Filename:      SetProcessorCompatibility.ps1
# Description:   Stops the specified virtual machine and
#                sets the desired compatibility options.

# Connect to the VMM server.
$VMMServer = Get-VMMServer -ComputerName "VMMServer01.Contoso.com"

# Get the name of the virtual machine and the compatibility option to update
# from the user.
$VM = Read-Host "Type the name of the virtual machine for which you want to set the processor compatibility." 
$Option = Read-Host "To allow migration to a virtual machine host with a different processor, type 1.`
To run an older operating system, type 2.`
To update both, type 3."

# Ensure that the virtual machine is stopped.
If ($VM.StatusString -ne "Stopped")
{
Stop-VM -VM $VM
}

# Set the compatibility options for the virtual machine.
If ($Option -eq "1")
{
Set-VM -VM $VM -LimitCPUForMigration $TRUE
}

If ($Option -eq "2")
{
Set-VM -VM $VM -LimitCPUFunctionality $TRUE
}

If ($Option -eq "3")
{
Set-VM -VM $VM -LimitCPUForMigration $TRUE
Set-VM -VM $VM -LimitCPUFunctionality $TRUE
}