how to disable vTPM using powershell script

ishan saxena 0 Reputation points
2025-01-16T16:13:47.45+00:00

We are trying to move our windows 11 VM from one cluster to another which requires vTPM (Trusted platform module) to be disabled. After re-enabling vTPM after performing the migration we get tmp error - C0090016, TPM has malfunctioned Microsoft 365 Sign-in Error

Is there a way to disable vTPM using powershell for windows 11 rather than doing on VM security setting from azure portal.

Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
10,455 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,745 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Markapuram Sudheer Reddy 255 Reputation points Microsoft Vendor
    2025-01-17T15:12:47.6166667+00:00

    Hi ishan saxena ,

    Thank you for reaching out us on Microsoft Q&A forum.

    You can follow below PowerShell command to disable vTPM on a windows 11 VM when hosted in a Azure environment. You need to modify UEFI properties of a Virtual Machine.

    $VM = Get-AzVM -ResourceGroupName "<your resource group name>" -VMName "<your VM name>" Set-AzVMUefi -VM $VM -EnableVtpm $false -EnableSecureBoot $false
    
    

    You can use the above PowerShell command and modify the input values based on your requirement before executing the command.

    You can follow below documentation for more information ;

    https://stackoverflow.com/questions/76627839/is-it-possible-to-make-uefi-settings-on-off-using-powershell-command-in-a-virtua

    https://learn.microsoft.com/en-us/powershell/module/az.compute/set-azvmuefi?view=azps-13.1.0

    If the information is helpful, please consider by clicking the "Accept Answer" & "Upvote".

    If you have any further queries, please let us know we are glad to help you.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.