Set-VMProcessor

Configures settings for the virtual processors of a virtual machine. Settings are applied uniformly to all virtual processors belonging to the virtual machine.

Syntax

VMName (Default)

Set-VMProcessor
    [-VMName] <String[]>
    [-CimSession <CimSession[]>]
    [-ComputerName <String[]>]
    [-Credential <PSCredential[]>]
    [-Count <Int64>]
    [-CompatibilityForMigrationEnabled <Boolean>]
    [-CompatibilityForOlderOperatingSystemsEnabled <Boolean>]
    [-HwThreadCountPerCore <Int64>]
    [-Maximum <Int64>]
    [-Reserve <Int64>]
    [-RelativeWeight <Int32>]
    [-MaximumCountPerNumaNode <Int32>]
    [-MaximumCountPerNumaSocket <Int32>]
    [-ResourcePoolName <String>]
    [-Perfmon <String>]
    [-EnableHostResourceProtection <Boolean>]
    [-ExposeVirtualizationExtensions <Boolean>]
    [-Passthru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

VMObject

Set-VMProcessor
    [-VM] <VirtualMachine[]>
    [-Count <Int64>]
    [-CompatibilityForMigrationEnabled <Boolean>]
    [-CompatibilityForOlderOperatingSystemsEnabled <Boolean>]
    [-HwThreadCountPerCore <Int64>]
    [-Maximum <Int64>]
    [-Reserve <Int64>]
    [-RelativeWeight <Int32>]
    [-MaximumCountPerNumaNode <Int32>]
    [-MaximumCountPerNumaSocket <Int32>]
    [-ResourcePoolName <String>]
    [-EnableHostResourceProtection <Boolean>]
    [-ExposeVirtualizationExtensions <Boolean>]
    [-Passthru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

VMProcessor

Set-VMProcessor
    [-VMProcessor] <VMProcessor[]>
    [-Count <Int64>]
    [-CompatibilityForMigrationEnabled <Boolean>]
    [-CompatibilityForOlderOperatingSystemsEnabled <Boolean>]
    [-HwThreadCountPerCore <Int64>]
    [-Maximum <Int64>]
    [-Reserve <Int64>]
    [-RelativeWeight <Int32>]
    [-MaximumCountPerNumaNode <Int32>]
    [-MaximumCountPerNumaSocket <Int32>]
    [-ResourcePoolName <String>]
    [-EnableHostResourceProtection <Boolean>]
    [-ExposeVirtualizationExtensions <Boolean>]
    [-Passthru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Set-VMProcessor cmdlet configures the virtual processors of a virtual machine.

Examples

Example 1

PS C:\> Set-VMProcessor TestVM -Count 2 -Reserve 10 -Maximum 75 -RelativeWeight 200

Configures virtual machine TestVM with two virtual processors, a reserve of 10%, a limit of 75%, and a relative weight of 200.

Example 2

PS C:\> Set-VMProcessor TestVM -CompatibilityForMigrationEnabled $true

Configures virtual machine TestVM, enabling processor compatibility for live migration.

Example 3

PS C:\> Set-VMProcessor TestVM -CompatibilityForOlderOperatingSystemsEnabled $true

Configures virtual machine TestVM, enabling compatibility for running older operating systems.

Example 4

PS C:\> Set-VMProcessor TestVM -ExposeVirtualizationExtensions $true

Configures virtual machine TestVM, enabling embedded Hyper-V.Uu

Example 5

PS C:\> Set-VMProcessor TestVM -Perfmon pmu,pebs,lbr

Configure your VM to expose PMU, PEBS, LBR for Performance Monitoring.

Parameters

-CimSession

Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.

Parameter properties

Type:

CimSession[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

VMName
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-CompatibilityForMigrationEnabled

Specifies whether the virtual processor's features are to be limited for compatibility when migrating the virtual machine to another host.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-CompatibilityForOlderOperatingSystemsEnabled

Specifies whether the virtual processor's features are to be limited for compatibility with older operating systems.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ComputerName

Specifies one or more Hyper-V hosts on which processors are to be configured. NetBIOS names, IP addresses, and fully qualified ___domain names are allowable. The default is the local computer. Use localhost or a dot (.) to specify the local computer explicitly.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

VMName
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Count

Specifies the number of virtual processors for the virtual machine.

Parameter properties

Type:Int64
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Credential

Specifies one or more user accounts that have permission to perform this action. The default is the current user.

Parameter properties

Type:

PSCredential[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

VMName
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EnableHostResourceProtection

Specifies whether to enable host resource protection on the virtual machine. When enabled, the host will enforce limits on some aspects of the virtual machine's activity, preventing excessive consumption of host compute resources. VM activities controlled by this setting include the VMbus pipe messages associated with a subset of the VM's virtual devices, and intercepts generated by the VM. The virtual devices affected include the video, keyboard, mouse, and dynamic memory VDEVs.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ExposeVirtualizationExtensions

Specifies whether the hypervisor should expose the presence of virtualization extensions to the virtual machine, which enables support for nested virtualization.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-HwThreadCountPerCore

Specifies the number of virtual SMT threads exposed to the virtual machine. Setting this value to 0 indicates the virtual machine will inherit the host's number of threads per core. This setting may not exceed the host's number of threads per core.

Note: Windows Server 2016 does not support setting HwThreadCountPerCore to 0. For more details, see Configuring VM SMT settings using PowerShell.

Parameter properties

Type:Int64
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Maximum

Specifies the maximum percentage of resources available to the virtual machine processor to be configured. Allowed values range from 0 to 100.

Parameter properties

Type:Int64
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MaximumCountPerNumaNode

Specifies the maximum number of processors per NUMA node to be configured for the virtual machine.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MaximumCountPerNumaSocket

Specifies the maximum number of sockets per NUMA node to be configured for the virtual machine.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Passthru

Specifies that a Microsoft.HyperV.PowerShell.Processor is to be passed through to the pipeline representing the processor to be configured.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Perfmon

Specifies the hardware to be Exposed for Performance Monitoring. For more information about requirements, visit Enable Intel Performance Monitoring Hardware in a Hyper-V virtual machine.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RelativeWeight

Specifies the priority for allocating the physical computer's processing power to this virtual machine relative to others. Allowed values range from 1 to 10000.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Reserve

Specifies the percentage of processor resources to be reserved for this virtual machine. Allowed values range from 0 to 100.

Parameter properties

Type:Int64
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ResourcePoolName

Specifies the name of the processor resource pool to be used.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-VM

Specifies the virtual machine on which the processor is to be configured.

Parameter properties

Type:

VirtualMachine[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

VMObject
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-VMName

Specifies the name of the virtual machine on which the processor is to be configured.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

VMName
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-VMProcessor

Specifies that the virtual machine's settings for virtual processors are to be configured.

Parameter properties

Type:

VMProcessor[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

VMProcessor
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Outputs

None

Default

Microsoft.HyperV.PowerShell.VMProcessor

If -PassThru is specified.