forked from dsccommunity/HyperVDsc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sample_xVMHyperV_SimpleWithNestedVirtualization.ps1
54 lines (47 loc) · 1.26 KB
/
Sample_xVMHyperV_SimpleWithNestedVirtualization.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
configuration Sample_xVMHyperV_SimpleWithNestedVirtualization
{
param
(
[Parameter()]
[string[]]
$NodeName = 'localhost',
[Parameter(Mandatory = $true)]
[string]
$VMName,
[Parameter(Mandatory = $true)]
[string]
$VhdPath,
[Parameter(Mandatory = $true)]
[Uint64]
$Memory
)
Import-DscResource -module xHyper-V
Node $NodeName
{
# Install HyperV feature, if not installed - Server SKU only
WindowsFeature HyperV
{
Ensure = 'Present'
Name = 'Hyper-V'
}
# Ensures a VM with default settings
xVMHyperV NewVM
{
Ensure = 'Present'
Name = $VMName
VhdPath = $VhdPath
Generation = 2
StartupMemory = $Memory
MinimumMemory = $Memory
MaximumMemory = $Memory
DependsOn = '[WindowsFeature]HyperV'
}
# Set the VM options
xVMProcessor NestedVirtualization
{
VMName = $VMName
ExposeVirtualizationExtensions = $true
DependsOn = '[xVMHyperV]NewVM'
}
}
}