Set-VMTPM

Set-VMTPM

Configures the TPM of virtual machines.

Syntax

Parameter Set: ResourceObject
Set-VMTPM [-VMTPM] <VMTPM[]> [-DataProtected <Boolean> ] [-Enabled <Boolean> ] [-KeyProtector <Byte[]> ] [-NewLocalKeyProtector] [-Passthru] [-Shielded <Boolean> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: VMName
Set-VMTPM [-VMName] <String[]> [-CimSession <CimSession[]> ] [-ComputerName <String[]> ] [-Credential <PSCredential[]> ] [-DataProtected <Boolean> ] [-Enabled <Boolean> ] [-KeyProtector <Byte[]> ] [-NewLocalKeyProtector] [-Passthru] [-Shielded <Boolean> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: VMObject
Set-VMTPM [-VM] <VirtualMachine[]> [-DataProtected <Boolean> ] [-Enabled <Boolean> ] [-KeyProtector <Byte[]> ] [-NewLocalKeyProtector] [-Passthru] [-Shielded <Boolean> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed Description

The Set-VMTPM cmdlet configures the virtual Trusted Platform Module (TPM) of virtual machines.

Parameters

-CimSession<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.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ComputerName<String[]>

Specifies one or more Hyper-V hosts that run this cmdlet. 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.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Credential<PSCredential[]>

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DataProtected<Boolean>

Specifies whether this cmdlet configures the TPM security profile to have the property DataProtected.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Enabled<Boolean>

Specifies whether this cmdlet enables TPM on the virtual machine.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-KeyProtector<Byte[]>

Specifies the key protector that TPM uses.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-NewLocalKeyProtector

Indicates that this cmdlet generates a new local key protector.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Passthru

Indicates that this cmdlet returns the Microsoft.HyperV.PowerShell.VMTPM object that it configures. By default, this cmdlet does not produce output.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Shielded<Boolean>

Specifies whether this cmdlet configures the TPM security profile to have the property Shielded.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VM<VirtualMachine[]>

Specifies an array of virtual machines for which this cmdlet configures a TPM. To obtain a virtual machine object, use the Get-VM cmdlet.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true(ByValue)

Accept Wildcard Characters?

false

-VMName<String[]>

Specifies an array of names of the virtual machines for which this cmdlet configures a TPM.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true(ByValue)

Accept Wildcard Characters?

false

-VMTPM<VMTPM[]>

Specifies an array of Microsoft.HyperV.Powershell.VMTPM objects that this cmdlet configures. To obtain a VMTPM object, use the Get-VMTPM cmdlet.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true(ByValue)

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before running the cmdlet.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

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

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see    about_CommonParameters.

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • Microsoft.HyperV.PowerShell.VMTPM

    This cmdlet returns a Microsoft.HyperV.Powershell.VMTPM object, if you specify the Passthru parameter.

Examples

Example 1: Enable TPM with data protected

This command enables TPM on the virtual machine named VM01 and configures it to use the DataProtected security profile.

PS C:\> Set-VMTPM -VMName "VM01" -Enabled $True -DataProtected $True 

Add-VMTPM

Get-VMTPM

Get-VM