Modifier

Partager via


Set-VMHost

Configures a Hyper-V host.

Syntax

Set-VMHost
   [[-ComputerName] <String[]>]
   [[-Credential] <PSCredential[]>]
   [-MaximumStorageMigrations <UInt32>]
   [-MaximumVirtualMachineMigrations <UInt32>]
   [-VirtualMachineMigrationAuthenticationType <MigrationAuthenticationType>]
   [-UseAnyNetworkForMigration <Boolean>]
   [-VirtualMachineMigrationPerformanceOption <VMMigrationPerformance>]
   [-ResourceMeteringSaveInterval <TimeSpan>]
   [-VirtualHardDiskPath <String>]
   [-VirtualMachinePath <String>]
   [-MacAddressMaximum <String>]
   [-MacAddressMinimum <String>]
   [-FibreChannelWwnn <String>]
   [-FibreChannelWwpnMaximum <String>]
   [-FibreChannelWwpnMinimum <String>]
   [-NumaSpanningEnabled <Boolean>]
   [-EnableEnhancedSessionMode <Boolean>]
   [-Passthru]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-VMHost
   [-CimSession] <CimSession[]>
   [-MaximumStorageMigrations <UInt32>]
   [-MaximumVirtualMachineMigrations <UInt32>]
   [-VirtualMachineMigrationAuthenticationType <MigrationAuthenticationType>]
   [-UseAnyNetworkForMigration <Boolean>]
   [-VirtualMachineMigrationPerformanceOption <VMMigrationPerformance>]
   [-ResourceMeteringSaveInterval <TimeSpan>]
   [-VirtualHardDiskPath <String>]
   [-VirtualMachinePath <String>]
   [-MacAddressMaximum <String>]
   [-MacAddressMinimum <String>]
   [-FibreChannelWwnn <String>]
   [-FibreChannelWwpnMaximum <String>]
   [-FibreChannelWwpnMinimum <String>]
   [-NumaSpanningEnabled <Boolean>]
   [-EnableEnhancedSessionMode <Boolean>]
   [-Passthru]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The Set-VMHost cmdlet configures a Hyper-V host.

Examples

Example 1

PS C:\> Set-VMHost -MaximumVirtualMachineMigrations 10 -MaximumStorageMigrations 10

This example configures the local Hyper-V host to allow 10 simultaneous live migrations and storage migrations.

Example 2

PS C:\> Set-VMHost -MacAddressMinimum 00155D020600 -MacAddressMaximum 00155D0206FF

This example configures a range of MAC addresses range for the local Hyper-V host.

Example 3

PS C:\> Set-VMHost -UseAnyNetworkForMigration $true

This example enables the use of any network for incoming live migrations on the local Hyper-V host.

Example 4

PS C:\> Set-VMHost -VirtualHardDiskPath "C:\Hyper-V\Virtual Hard Disks" -VirtualMachinePath "C:\Hyper-V"

This example specifies new default locations for virtual hard disks and virtual machines on the local Hyper-V host. In this case:

  • Virtual machines are stored in "C:\Hyper-V\Virtual Machines" (not "C:\Hyper-V")
  • Virtual hard disks are stored in "C:\Hyper-V\Virtual Hard Disks"

Example 5

PS C:\> Set-VMHost -FibreChannelWwnn C003FF0000FFFF00 -FibreChannelWwpnMinimum C003FF661D200000 -FibreChannelWwpnMaximum C003FF661D200000

This example configures Fibre Channel host settings on the local Hyper-V host.

Example 6

PS C:\> Set-VMHost -NumaSpanningEnabled $false

This example disables NUMA spanning on the local Hyper-V host.

Example 7

PS C:\> Set-VMHost -ResourceMeteringSaveInterval 01:30:00

This example configures the local Hyper-V host to save data that tracks resource consumption every hour and a half.

Example 8

PS C:\> Set-VMHost -VirtualMachineMigrationAuthenticationType Kerberos

The example configures the local Hyper-V host to use Kerberos to authenticate incoming live migrations.

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.

Type:CimSession[]
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ComputerName

Specifies one or more Hyper-V hosts on which this cmdlet operates. 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.

Type:String[]
Position:0
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Credential

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

Type:PSCredential[]
Position:1
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-EnableEnhancedSessionMode

Indicates whether users can use enhanced mode when they connect to virtual machines on this server by using Virtual Machine Connection.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-FibreChannelWwnn

Specifies the default value of the World Wide Node Name on the Hyper-V host.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-FibreChannelWwpnMaximum

Specifies the maximum value that can be used to generate World Wide Port Names on the Hyper-V host. Use with the FibreChannelWwpnMinimum parameter to establish a range of WWPNs that the specified Hyper-V host can assign to virtual Fibre Channel adapters.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-FibreChannelWwpnMinimum

Specifies the minimum value that can be used to generate the World Wide Port Names on the Hyper-V host. Use with the FibreChannelWwpnMaximum parameter to establish a range of WWPNs that the specified Hyper-V host can assign to virtual Fibre Channel adapters.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-MacAddressMaximum

Specifies the maximum MAC address using a valid hexadecimal value. Use with the MacAddressMinimum parameter to establish a range of MAC addresses that the specified Hyper-V host can assign to virtual machines configured to receive dynamic MAC addresses.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-MacAddressMinimum

Specifies the minimum MAC address using a valid hexadecimal value. Use with the MacAddressMaximum parameter to establish a range of MAC addresses that the specified Hyper-V host can assign to virtual machines configured to receive dynamic MAC addresses.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-MaximumStorageMigrations

Specifies the maximum number of storage migrations that can be performed at the same time on the Hyper-V host.

Type:UInt32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-MaximumVirtualMachineMigrations

Specifies the maximum number of live migrations that can be performed at the same time on the Hyper-V host.

Type:UInt32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-NumaSpanningEnabled

Specifies whether virtual machines on the Hyper-V host can use resources from more than one NUMA node.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Passthru

Specifies that a Microsoft.HyperV.PowerShell.Host is to be passed through to the pipeline representing the Hyper-V host to be configured.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ResourceMeteringSaveInterval

Specifies how often the Hyper-V host saves the data that tracks resource usage. The range is a minimum of 1 hour to a maximum of 24 hours. Time within that range can be specified using a format of hh:mm:ss, where hh indicates hours, mm indicates minutes, and ss indicates seconds. You also can use a Timespan object to specify the interval.

Type:TimeSpan
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-UseAnyNetworkForMigration

Specifies how networks are selected for incoming live migration traffic. If set to $True, any available network on the host can be used for this traffic. If set to $False, incoming live migration traffic is transmitted only on the networks specified in the MigrationNetworks property of the host. The Get-VMMigrationNetwork cmdlet returns the list of networks that can be used for migration traffic.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-VirtualHardDiskPath

Specifies the default folder to store virtual hard disks on the Hyper-V host. This is not a functional setting. The Hyper-V Manager snap-in and Windows Admin Center query it to offer you a default path, but the Hyper-V API (for example CreateFixedVirtualHardDisk) and New-VHD don't use it.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-VirtualMachineMigrationAuthenticationType

Specifies the type of authentication to be used for live migrations. The acceptable values for this parameter are: Kerberos and CredSSP.

Type:MigrationAuthenticationType
Accepted values:CredSSP, Kerberos
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-VirtualMachineMigrationPerformanceOption

Specifies the performance option to use for live migration. The acceptable values for this parameter are:

  • Compression. Compress data to speed up live migration on constrained networks.
  • SMBTransport. Use server message block (SMB) to get the highest throughput possible.
  • None. Perform standard live migration.
Type:VMMigrationPerformance
Accepted values:TCPIP, Compression, SMB
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-VirtualMachinePath

Specifies the default folder to store virtual machine configuration files on the Hyper-V host. This is a functional setting, meaning that if you do not supply a path to VM creation tools (for example New-VM), Hyper-V will use this path. Hyper-V will create at least one subfolder in this path, called "Virtual Machines".

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

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

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Outputs

None

Default

Microsoft.HyperV.PowerShell.VMHost

If -PassThru is specified.