Set-VMFirmware

Set-VMFirmware

Sets the firmware configuration of a virtual machine.

語法

Parameter Set: VMName
Set-VMFirmware [-VMName] <String[]> [-BootOrder <VMComponentObject[]> ] [-ComputerName <String[]> ] [-EnableSecureBoot <OnOffState> ] [-FirstBootDevice <VMComponentObject> ] [-Passthru] [-PreferredNetworkBootProtocol <IPProtocolPreference> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: VMFirmware
Set-VMFirmware [-VMFirmware] <VMFirmware[]> [-BootOrder <VMComponentObject[]> ] [-EnableSecureBoot <OnOffState> ] [-FirstBootDevice <VMComponentObject> ] [-Passthru] [-PreferredNetworkBootProtocol <IPProtocolPreference> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: VMObject
Set-VMFirmware [-VM] <VirtualMachine[]> [-BootOrder <VMComponentObject[]> ] [-EnableSecureBoot <OnOffState> ] [-FirstBootDevice <VMComponentObject> ] [-Passthru] [-PreferredNetworkBootProtocol <IPProtocolPreference> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

詳細描述

The Set-VMFirmware cmdlet sets the firmware configuration of a Generation 2 virtual machine.

參數

-BootOrder<VMComponentObject[]>

Specifies an array of devices. The boot order determines the order of the devices from which to boot. 此參數接受的值包括:

  -- VMBootSource
  -- VMNetworkAdapter
  -- HardDiskDrive
  -- DVDDrive

The VMBootSource value describes a boot entry in firmware nonvolatile Random Access Memory (NVRAM).

別名

必要?

false

位置?

named

預設值

接受管線輸入?

false

接受萬用字元?

false

-ComputerName<String[]>

Specifies the names of the Hyper-V hosts whose firmware configuration you want to modify.

別名

必要?

false

位置?

named

預設值

.

接受管線輸入?

false

接受萬用字元?

false

-EnableSecureBoot<OnOffState>

Specifies whether to enable secure boot. 此參數接受的值包括:

  -- On
  -- Off

Secure boot uses a public key infrastructure that protects the integrity of the operating system.

別名

必要?

false

位置?

named

預設值

接受管線輸入?

false

接受萬用字元?

false

-FirstBootDevice<VMComponentObject>

Specifies the device from which to attempt to boot from first. 此參數接受的值包括:

  -- VMBootSource
  -- VMNetworkAdapter
  -- HardDiskDrive
  -- DVDDrive

The VMBootSource value describes a boot entry in firmware NVRAM.

別名

必要?

false

位置?

named

預設值

接受管線輸入?

false

接受萬用字元?

false

-Passthru

將表示您正在使用的項目的物件傳回。根據預設,此 Cmdlet 不會產生任何輸出。

別名

必要?

false

位置?

named

預設值

接受管線輸入?

false

接受萬用字元?

false

-PreferredNetworkBootProtocol<IPProtocolPreference>

Specifies the IP protocol version to use during a network boot.

別名

必要?

false

位置?

named

預設值

接受管線輸入?

false

接受萬用字元?

false

-VM<VirtualMachine[]>

Specifies the virtual machine objects for which want to modify the firmware configuration. To obtain a virtual machine object, use the Get-VM cmdlet.

別名

必要?

true

位置?

1

預設值

接受管線輸入?

True (ByValue)

接受萬用字元?

false

-VMFirmware<VMFirmware[]>

Specifies an array of virtual machine firmware configurations. The cmdlet sets the firmware configurations you specify.

別名

必要?

true

位置?

1

預設值

接受管線輸入?

True (ByValue)

接受萬用字元?

false

-VMName<String[]>

Specifies an array of names of virtual machines for which you want to modify the firmware configuration.

別名

必要?

true

位置?

1

預設值

接受管線輸入?

True (ByValue)

接受萬用字元?

false

-Confirm

執行 Cmdlet 之前先提示您確認。

必要?

false

位置?

named

預設值

false

接受管線輸入?

false

接受萬用字元?

false

-WhatIf

顯示執行 Cmdlet 後會發生的情況。未執行 Cmdlet。

必要?

false

位置?

named

預設值

false

接受管線輸入?

false

接受萬用字元?

false

<CommonParameters>

此 Cmdlet 支援一般參數:-Verbose、-Debug、-ErrorAction、-ErrorVariable、-OutBuffer 與 -OutVariable。如需詳細資訊,請參閱 about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216)。

輸入

輸入類型是您可以使用管線處理方式傳遞給 Cmdlet 的物件類型。

輸出

輸出類型是 Cmdlet 所發出的物件類型。

  • Microsoft.HyperV.Powershell.VMFirmware

附註

  • Note: This cmdlet is supported only when run against Generation 2 virtual machines.

範例

Example 1

This example enables secure boot functionality on the virtual machine “Test VM”.

PS C:\> Set-VMFirmware "Test VM" -EnableSecureBoot On

Example 2

This example sets the virtual machine “Test VM” to boot off of the VM network adapter object stored in $vmNetworkAdapter. This object was acquired using get-VMNetworkAdapter.

PS C:\> Set-VMFirmware "Test VM" -FirstBootDevice $vmNetworkAdapter

Example 3

Sets the boot order for the virtual machine “Test VM”. $vmNetworkAdapter contains a VM Network Adapter object (acquired using get-VMNetworkAdapter) and $vmHardDiskDrive contains a VM hard disk object (acquired using get-VMHardDiskDrive). Any existing boot entries not specified by this command will be removed from the virtual machine.

PS C:\> Set-VMFirmware "Test VM" -BootOrder $vmNetworkAdapter, $vmHardDiskDrive

相關主題

Get-VMFirmware