Set-VMFirmware
Set-VMFirmware
Sets the firmware configuration of a virtual machine.
語法
Parameter Set: VMName
Set-VMFirmware [-VMName] <String[]> [-BootOrder <VMComponentObject[]> ] [-CimSession <Microsoft.Management.Infrastructure.CimSession[]> ] [-ComputerName <String[]> ] [-ConsoleMode <Nullable [Microsoft.HyperV.PowerShell.ConsoleModeType]> ] [-Credential <System.Management.Automation.PSCredential[]> ] [-EnableSecureBoot <OnOffState]> ] [-FirstBootDevice <VMComponentObject> ] [-Passthru] [-PauseAfterBootFailure <Nullable [Microsoft.HyperV.PowerShell.OnOffState]> ] [-PreferredNetworkBootProtocol <IPProtocolPreference]> ] [-SecureBootTemplate <System.String> ] [-SecureBootTemplateId <Nullable [System.Guid]> ] [-Confirm] [-WhatIf] [ <CommonParameters>]
Parameter Set: VMFirmware
Set-VMFirmware [-VMFirmware] <VMFirmware[]> [-BootOrder <VMComponentObject[]> ] [-ConsoleMode <Nullable [Microsoft.HyperV.PowerShell.ConsoleModeType]> ] [-EnableSecureBoot <OnOffState]> ] [-FirstBootDevice <VMComponentObject> ] [-Passthru] [-PauseAfterBootFailure <Nullable [Microsoft.HyperV.PowerShell.OnOffState]> ] [-PreferredNetworkBootProtocol <IPProtocolPreference]> ] [-SecureBootTemplate <System.String> ] [-SecureBootTemplateId <Nullable [System.Guid]> ] [-Confirm] [-WhatIf] [ <CommonParameters>]
Parameter Set: VMObject
Set-VMFirmware [-VM] <VirtualMachine[]> [-BootOrder <VMComponentObject[]> ] [-ConsoleMode <Nullable [Microsoft.HyperV.PowerShell.ConsoleModeType]> ] [-EnableSecureBoot <OnOffState]> ] [-FirstBootDevice <VMComponentObject> ] [-Passthru] [-PauseAfterBootFailure <Nullable [Microsoft.HyperV.PowerShell.OnOffState]> ] [-PreferredNetworkBootProtocol <IPProtocolPreference]> ] [-SecureBootTemplate <System.String> ] [-SecureBootTemplateId <Nullable [System.Guid]> ] [-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).
別名 |
none |
必要項? |
false |
位置? |
named |
預設值 |
none |
接受管線輸入? |
false |
接受萬用字元? |
false |
-CimSession<Microsoft.Management.Infrastructure.CimSession[]>
在遠端工作階段或遠端電腦上執行 Cmdlet。輸入電腦名稱或工作階段物件,例如 New-CimSession 或 Get-CimSession Cmdlet 的輸出。預設為本機電腦上目前的工作階段。
別名 |
none |
必要項? |
false |
位置? |
named |
預設值 |
none |
接受管線輸入? |
false |
接受萬用字元? |
false |
-ComputerName<String[]>
Specifies the names of the Hyper-V hosts whose firmware configuration you want to modify.
別名 |
none |
必要項? |
false |
位置? |
named |
預設值 |
none |
接受管線輸入? |
false |
接受萬用字元? |
false |
-ConsoleMode<Nullable [Microsoft.HyperV.PowerShell.ConsoleModeType]>
Specifies the console mode type for the virtual machine. This parameter allows a virtual machine to run without graphical user interface.
別名 |
none |
必要項? |
false |
位置? |
named |
預設值 |
none |
接受管線輸入? |
false |
接受萬用字元? |
false |
-Credential<System.Management.Automation.PSCredential[]>
Specifies one or more user accounts that have permission to perform this action. The default is the current user.
別名 |
none |
必要項? |
false |
位置? |
named |
預設值 |
none |
接受管線輸入? |
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.
別名 |
none |
必要項? |
false |
位置? |
named |
預設值 |
none |
接受管線輸入? |
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.
別名 |
none |
必要項? |
false |
位置? |
named |
預設值 |
none |
接受管線輸入? |
false |
接受萬用字元? |
false |
-Passthru
傳回物件,表示您所使用的項目。此 Cmdlet 依預設不會產生任何輸出。
別名 |
none |
必要項? |
false |
位置? |
named |
預設值 |
none |
接受管線輸入? |
false |
接受萬用字元? |
false |
-PauseAfterBootFailure<Nullable [Microsoft.HyperV.PowerShell.OnOffState]>
Specifies the behavior of the virtual machine after a start failure. For a value of On, if the virtual machine fails to start correctly from a device, the virtual machine is paused.
別名 |
none |
必要項? |
false |
位置? |
named |
預設值 |
none |
接受管線輸入? |
false |
接受萬用字元? |
false |
-PreferredNetworkBootProtocol<IPProtocolPreference]>
Specifies the IP protocol version to use during a network boot.
別名 |
none |
必要項? |
false |
位置? |
named |
預設值 |
none |
接受管線輸入? |
false |
接受萬用字元? |
false |
-SecureBootTemplate<System.String>
Specifies the name of the secure boot template. If secure boot is enabled, you must have a valid secure boot template for the guest operating system to start.
別名 |
none |
必要項? |
false |
位置? |
named |
預設值 |
none |
接受管線輸入? |
false |
接受萬用字元? |
false |
-SecureBootTemplateId<Nullable [System.Guid]>
Specifies the ID of the secure boot template.
別名 |
none |
必要項? |
false |
位置? |
named |
預設值 |
none |
接受管線輸入? |
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.
別名 |
none |
必要項? |
true |
位置? |
1 |
預設值 |
none |
接受管線輸入? |
True (ByValue) |
接受萬用字元? |
false |
-VMFirmware<VMFirmware[]>
Specifies an array of virtual machine firmware configurations. The cmdlet sets the firmware configurations you specify.
別名 |
none |
必要項? |
true |
位置? |
1 |
預設值 |
none |
接受管線輸入? |
True (ByValue) |
接受萬用字元? |
false |
-VMName<String[]>
Specifies an array of names of virtual machines for which you want to modify the firmware configuration.
別名 |
none |
必要項? |
true |
位置? |
1 |
預設值 |
none |
接受管線輸入? |
True (ByValue) |
接受萬用字元? |
false |
-Confirm
在執行指令程式之前提示您確認。
必要項? |
false |
位置? |
named |
預設值 |
false |
接受管線輸入? |
false |
接受萬用字元? |
false |
-WhatIf
示範當執行指令程式時會發生什麼事情。此指令程式並未執行。
必要項? |
false |
位置? |
named |
預設值 |
false |
接受管線輸入? |
false |
接受萬用字元? |
false |
<CommonParameters>
這個指令程式支援一般參數:-Verbose、-Debug、-ErrorAction、-ErrorVariable、-OutBuffer 和 -OutVariable。如需詳細資訊,請參閱 about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216)。
輸入
輸入類型是可透過管道傳送至指令程式的物件類型。
輸出
輸出類型是指令程式所發出的物件類型。
- 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