英文:
Is it possible to make UEFI settings ON/OFF using PowerShell command in a virtual machine?
问题
我想在Azure中创建一个虚拟机,其中安全类型为“受信任的启动”,安全配置文件具有启用了SecureBoot和vTPM的UEFI设置。
现在,一旦虚拟机部署完成,我想使用PowerShell命令关闭UEFI设置,反之亦然。这是否可能?
英文:
I want to create a Virtual Machine in Azure with security Type as Trusted Launch where security profile has UEFI settings like SecureBoot and vTPM enabled.
Now, Once VM is deployed I want to turn off the UEFI settings, and Vice Versa using PowerShell command. Is it possible?
答案1
得分: 0
以下是关于在 Azure 虚拟机中启用和禁用 UEFI 设置的 PowerShell 命令:
启用 UEFI 设置:
$VM = Get-AzVM -ResourceGroupName "rg_name" -VMName "vm_name"
Set-AzVMUefi -VM $VM -EnableVtpm $true -EnableSecureBoot $true
Update-AzVM -VM $VM -ResourceGroupName "rg_name"
禁用 UEFI 设置:
$VM = Get-AzVM -ResourceGroupName "rg_name" -VMName "vm_name"
Set-AzVMUefi -VM $VM -EnableVtpm $false -EnableSecureBoot $false
Update-AzVM -VM $VM -ResourceGroupName "rg_name"
这些命令用于在 Azure 虚拟机中管理 UEFI 设置。
英文:
You can make use of below Az
PowerShell commands to turn UEFI settings ON
in Azure virtual machine.
$VM = Get-AzVM -ResourceGroupName "rg_name" -VMName "vm_name"
Set-AzVMUefi -VM $VM -EnableVtpm $true -EnableSecureBoot $true
Update-AzVM -VM $VM -ResourceGroupName "rg_name"
While creating virtual machine, these settings will be enabled by default like below:
To turn above UEFI settings OFF
in Azure virtual machine, you can make use of below Az
PowerShell command by including $false in it like this:
$VM = Get-AzVM -ResourceGroupName "rg_name" -VMName "vm_name"
Set-AzVMUefi -VM $VM -EnableVtpm $false -EnableSecureBoot $false
Update-AzVM -VM $VM -ResourceGroupName "rg_name"
Response:
When I checked the same in Portal, settings are disabled successfully like below:
Reference:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论