-
Notifications
You must be signed in to change notification settings - Fork 63
VMHyperV: Added the ability to enable or disable the TPM on a VM #215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
05797fc
54fb417
5867ff0
ed85809
5187f7e
5c8dd62
9edcb0b
51d847d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ class DSC_VMHyperV : OMI_BaseResource | |
| [Write, Description("Specifies if the VM should be Present (created) or Absent (removed). The default value is `Present`."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; | ||
| [Write, Description("Notes about the VM.")] String Notes; | ||
| [Write, Description("Specifies if Secure Boot should be enabled for Generation 2 virtual machines. **Only supports generation 2 virtual machines**. Default value is `$true`.")] Boolean SecureBoot; | ||
| [Write, Description("Specifies if Trusted Platform Module (TPM) should be enabled for Generation 2 virtual machines. **Only supports generation 2 virtual machines**. Default value is `$false`.")] Boolean EnableTPM; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Align You’ve added a writable Consider either:
Based on learnings, … 🤖 Prompt for AI Agents |
||
| [Write, Description("Enable Guest Service Interface for the VM. The default value is `$false`.")] Boolean EnableGuestService; | ||
| [Write, Description("Enable AutomaticCheckpoints for the VM.")] Boolean AutomaticCheckpointsEnabled; | ||
| [Read, Description("Returns the unique ID for the VM.")] String ID; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| <# | ||
| .SYNOPSIS | ||
| Creates a Generation 2 VM with the Trusted Platform Module (TPM) enabled. | ||
|
|
||
| .DESCRIPTION | ||
| Creates a new Generation 2 virtual machine and enables the Trusted | ||
| Platform Module (TPM) on it. | ||
|
|
||
| .PARAMETER NodeName | ||
| The names of one or more nodes to compile a configuration for. | ||
| Defaults to 'localhost'. | ||
|
|
||
| .PARAMETER VMName | ||
| The name of the virtual machine to create. | ||
|
|
||
| .PARAMETER VhdPath | ||
| The path to the VHDX file to associate with the virtual machine. | ||
|
|
||
| .INPUTS | ||
| None. | ||
|
|
||
| .OUTPUTS | ||
| None. | ||
|
|
||
| .EXAMPLE | ||
| Example -VMName 'TPMVM' -VhdPath 'C:\VMs\TPMVM.vhdx' | ||
|
|
||
| Compiles a configuration that creates a Generation 2 VM named 'TPMVM' | ||
| with TPM enabled. | ||
| #> | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| configuration Example | ||
| { | ||
| param | ||
| ( | ||
| [System.String[]] | ||
| $NodeName = 'localhost', | ||
|
|
||
| [Parameter(Mandatory = $true)] | ||
| [System.String] | ||
| $VMName, | ||
|
|
||
| [Parameter(Mandatory = $true)] | ||
| [System.String] | ||
| $VhdPath | ||
| ) | ||
|
|
||
| Import-DscResource -ModuleName 'HyperVDsc' | ||
|
|
||
| Node $NodeName | ||
| { | ||
| # Install HyperV feature, if not installed - Server SKU only | ||
| WindowsFeature HyperV | ||
| { | ||
| Ensure = 'Present' | ||
| Name = 'Hyper-V' | ||
| } | ||
|
|
||
| # Ensures a VM with default settings | ||
| VMHyperV NewVM | ||
| { | ||
| Ensure = 'Present' | ||
| Name = $VMName | ||
| VhdPath = $VhdPath | ||
| Generation = 2 | ||
| EnableTPM = $true | ||
| DependsOn = '[WindowsFeature]HyperV' | ||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.