Source |
|
DSC Resource |
|
Documentation |
Parameter | Attribute | DataType | Description | Allowed Values | ||
---|---|---|---|---|---|---|
HostOS |
String |
Host Operating System Supported are Windows Server and Windows 10 |
|
|||
EnableEnhancedSessionMode |
Boolean |
Indicates whether users can use enhanced mode when they connect to virtual machines on this server by using Virtual Machine Connection. |
|
|||
VirtualHardDiskPath |
String |
Specifies the default folder to store virtual hard disks on the Hyper-V host. |
||||
VirtualMachinePath |
String |
Specifies the default folder to store virtual machine configuration files on the Hyper-V host. |
||||
Hashtable[] |
Set of virtual switches |
|||||
Hashtable[] |
Set of virtual machines
|
Parameter | Attribute | DataType | Description | Allowed Values | ||||
---|---|---|---|---|---|---|---|---|
Name |
Key |
String |
The desired VM Switch name. |
|||||
Type |
Key |
String |
The desired type of switch.
|
|
||||
NetAdapterName |
String[] |
Network adapter name(s) for external switch type. |
||||||
AllowManagementOS |
Boolean |
Specify if the VM host has access to the physical NIC. |
|
|||||
EnableEmbeddedTeaming |
Boolean |
Should embedded NIC teaming be used (Windows Server 2016 only). |
|
|||||
BandwidthReservationMode |
String |
Specify the QoS mode used (options other than NA are only supported on Hyper-V 2012+). |
|
|||||
LoadBalancingAlgorithm |
String |
Specify the Load Balancing algorithm which should be used for the embedded NIC teaming. |
|
|||||
Id |
Boolean |
Specify the desired Unique ID of the Hyper-V switch. |
||||||
AddressSpace |
String |
Address space of virtual network defined in the format '192.168.10.0/24'
|
||||||
IpAddress |
String |
The desired IP address of the network adapter which is connected to the Hyper-V switch.
|
||||||
Gateway |
String |
The desired default gateway address. |
||||||
InterfaceMetric |
UInt32 |
Specifies the metric for an IP interface (IPv4 and IPv6).
|
||||||
NetworkCategory |
String |
Specifies the category of the network. The category is set at the host network adapter connected to the switch.
You cannot set the category to The acceptable values for this parameter are:
|
|
|||||
Ensure |
String |
Ensures that the VM Switch is Present or Absent. |
|
Parameter | Attribute | DataType | Description | Allowed Values |
---|---|---|---|---|
Name |
Key |
String |
The desired VM name. |
|
VhdPath |
Required |
String |
The desired VHD associated with the VM. |
|
SwitchName |
String[] |
Virtual switch(es) associated with the VM. Multiple NICs can now be assigned. |
||
Assigned network adapters. |
||||
State |
String |
State of the VM. |
|
|
Path |
String |
Folder where the VM data will be stored. |
||
SecureBoot |
Boolean |
Enables or disables secure boot only on generation 2 virtual machines. |
|
|
StartupMemory |
Uint64 |
Startup RAM for the VM. If neither MinimumMemory nor MaximumMemory is specified, dynamic memory will be disabled. |
||
MinimumMemory |
Uint64 |
Minimum RAM for the VM. Setting this property enables dynamic memory. |
||
MaximumMemory |
Uint64 |
Maximum RAM for the VM. Setting this property enables dynamic memory. |
||
MACAddress |
String[] |
MAC address(es) of the VM. |
||
ProcessorCount |
Uint32 |
Processor count for the VM. |
||
WaitForIP |
Boolean |
If specified, waits for the VM to get valid IP address. |
||
RestartIfNeeded |
Boolean |
If specified, will shutdown and restart the VM as needed for property changes. |
||
CheckpointType |
String |
Allows you to configure the type of checkpoints created by Hyper-V. The acceptable values for this parameter are:
|
|
|
AutomaticCheckpointsEnabled |
Boolean |
Specifies whether automatic checkpoints are enabled. |
|
|
AutomaticStartAction |
String |
Specifies the action the virtual machine is to take upon start. |
|
|
AutomaticStartDelay |
Int32 |
Specifies the number of seconds by which the virtual machine’s start should be delayed. |
||
AutomaticStopAction |
String |
Specifies the action the virtual machine is to take when the virtual machine host shuts down. |
|
|
TpmEnabled |
Boolean |
Enables the Trusted Platform Module (TPM) functionality on the virtual machine. |
|
|
EncryptStateAndVmMigrationTraffic |
Boolean |
Indicates that this cmdlet enables encryption of virtual machine state and migration traffic. |
|
|
Ensure |
String |
Ensures that the VM is Present or Absent. |
|
|
Notes |
String |
Notes about the VM. |
||
EnableGuestService |
Boolean |
Enable Guest Service Interface for the VM. |
|
|
EnableTimeSyncService |
Boolean |
Enable Time Synchronisation Service for the VM. |
|
|
Assigned virtual disks. Disks will be created in |
||||
Assigned virtual drives. |
Parameter | Attribute | DataType | Description | Allowed Values | ||||
---|---|---|---|---|---|---|---|---|
Name |
Key |
String |
Interface Name of the network adapter |
|||||
SwitchName |
Mandatory |
String |
Name of the connected switch |
|||||
MacAddress |
String |
MAC-Address of the network adapter |
||||||
IgnoreNetworkSetting |
Boolean |
Specifies whether the IpAddress information for the network adapter is set or ignored |
|
|||||
Hashtable |
Network settings
|
|||||||
VlanId |
String |
|||||||
DhcpGuard |
String |
Specifies whether to drop DHCP messages from a virtual machine claiming to be a DHCP server. Allowed values are On, which drops DHCP messages because the virtualized DHCP server is considered untrusted) or Off, which allows the message to be received because the virtualized DHCP server is considered to be trustworthy. |
|
|||||
RouterGuard |
String |
Specifies whether to drop Router Advertisement and Redirection messages from unauthorized virtual machines. The value can be either On or Off. If On is specified, such messages are dropped. If Off is specified, such messages are sent. |
|
Parameter | Attribute | DataType | Description | Allowed Values |
---|---|---|---|---|
IpAddress |
String |
The desired IP address. |
||
Subnet |
String |
Subnet mask for the scope specified in IP address format |
||
DefaultGateway |
String |
The desired default gateway address. |
||
DnsServer |
String |
The desired DNS Server address. |
Parameter | Attribute | DataType | Description | Allowed Values |
---|---|---|---|---|
Name |
Key |
String |
The VHD drive letter. |
|
Path |
String |
The path of the VHD file. |
||
Size |
String |
The size of the VHD in GB. |
||
CopyFrom |
String |
The file name of an existing VHD. |
||
Hashtable[] |
Copy files from host to VM system disk before first start of VM |
Parameter | Attribute | DataType | Description | Allowed Values | ||
---|---|---|---|---|---|---|
Sources |
String[] |
Specifies the path to the items on host computer to copy to VM system drive. Wildcard characters are permitted. |
||||
Destination |
String |
Target directory on VM system drive.
|
||||
Excludes |
String[] |
Specifies a items that are excluded from the copy operation. The value of this attributes qualifies the The attribute is effective only when the command includes the contents of an item, such as |
||||
PrepareScripts |
String[] |
Specifies single line Powershell script blocks which are executed on host computer before starting the copy actions. These scripts can be used to create customized files for the target VM. |
Important
|
The first disk must be the system drive. |
Parameter | Attribute | DataType | Description | Allowed Values |
---|---|---|---|---|
Name |
Key |
String |
The VHD drive letter. |
|
Path |
String |
The path of the VHD file. |
||
Size |
String |
The size of the VHD in GB. |
||
CopyFrom |
String |
The file name of an existing VHD. |
Important
|
The last drive must be the OS installation drive. |
HyperV:
HostOS: Server # Client -> for Windows 10 Hyper-V Hosts
VMSwitches:
- Name: VMSwitchInt
Type: Internal
NetworkCategory: Private
InterfaceMetric: 50
- Name: VMSwitchExt
Type: External
NetAdapterName: Ethernet2
- Name: VMSwitchNat
Type: NAT
AddressSpace: 192.168.0.0/24
IpAddress: 192.168.0.1
VMMachines:
- Name: XXXADC
Path: C:\VServer
State: Running
ProcessorCount: 2
StartupMemory: 4GB
Notes: "Active Directory Controller"
CheckpointType: Standard
AutomaticCheckpointsEnabled: True
AutomaticStartAction: Start
AutomaticStartDelay: 30
AutomaticStopAction: Save
TpmEnabled: True
EncryptStateAndVmMigrationTraffic: True
EnableGuestService: True
EnableTimeSyncService: True
NetworkAdapters:
- Name: Ethernet
SwitchName: VMSwitchExt
MacAddress: 00-17-FB-00-00-07
VlanId: 100
NetworkSetting:
IpAddress: 192.168.0.10
Subnet: 255.255.255.255
DefaultGateway: 192.168.0.1
DnsServer: 192.168.0.1
- Name: HostNet
SwitchName: VMSwitchInt
DhcpGuard: On
RouterGuard: Off
Disks:
- Name: C
Size: 100GB
Drives:
- Name: S
Path: T:\ISOs\SoftwarePackages.iso
- Name: Z
Path: T:\ISOs\WinSrv_IoT_2019_Standard.iso
- Name: XXXAPP
Path: C:\VServer
State: Running
ProcessorCount: 4
StartupMemory: 4GB
SwitchName:
- HostNet
- PublicNet
Notes: "APP Server"
Disks:
- Name: C
Size: 100GB
CopyFrom: T:\Disks\System.vhdx # Copy prepared VHDX
CopyOnce: # Copy Files from Host into VHDX before VM starts at first time
- Sources:
- D:\DSC_Config\Push\CompressedModules\*
- D:\DSC_Config\Push\MOF\*
- D:\DSC_Config\Push\MetaMOF\*
- D:\DSC_Config\Push\dnsservers.txt
Destination: DSC_Config\
Excludes:
- '*.txt'
- '*.log'
PrepareScripts:
- '"192.168.0.1" | Set-Content -Path "D:\DSC_Config\Push\dnsservers.txt" -Force'
- Sources: D:\DSC_Config\Pull\*
Destination: DSCPullserver_Config\
- Name: D
Size: 500GB
Path: C:\VirtualDisks # VHD will be created in the specified path
- Name: E
CopyFrom: T:\Disks\Backup.vhdx
Drives:
- Name: S
Path: T:\ISOs\SoftwarePackages.iso
- Name: XXXHLP
Path: C:\VServer
State: Running
ProcessorCount: 4
StartupMemory: 4GB
SwitchName:
- HostNet
- PublicNet
Notes: "HELP Server"
Disks:
- Name: C
Size: 100GB
CopyFrom: T:\Disks\System.vhdx # Copy prepared VHDX
CopyOnce: # Copy Files from Host into VHDX before VM starts at first time
Sources: D:\DSC_Config\Push\*
Destination: DSC_Config\
Drives:
- Name: S
Path: T:\ISOs\SoftwarePackages.iso
Datum.yml
(Excerpt)lookup_options:
HyperV:
merge_hash: deep
HyperV\VMSwitches:
merge_hash_array: UniqueKeyValTuples
merge_options:
tuple_keys:
- Name
HyperV\VMMachines:
merge_hash_array: UniqueKeyValTuples
merge_options:
tuple_keys:
- Name