HyperVState manages the runtime state (start, stop, save) of Hyper-V virtual machines.
Use this resource when you need to ensure Hyper-V virtual machines are in a specific running state. Unlike the HyperV resource which creates and configures VMs, this resource controls whether VMs are running, stopped, or saved. Use it to enforce desired VM states after initial provisioning.
It can be used to switch the default parameters of the HyperV configuration at the end of the DSC configuration. So you can create all VM definitions at the beginning, install Windows Updates, make some necessary reboots and safely start these VMs at last step in the DSC configuration after all critical actions are done.
Source |
|
DSC Resource |
|
Documentation |
| Parameter | Attribute | DataType | Description | Allowed Values |
|---|---|---|---|---|
Mandatory |
Hashtable[] |
Set of virtual machines |
| Parameter | Attribute | DataType | Description | Allowed Values |
|---|---|---|---|---|
Name |
Key |
String |
The desired VM name. |
|
State |
String |
State of the VM. |
|
|
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. |
|
HyperVState:
VMMachines:
- Name: XXXADC
State: Running
AutomaticStartAction: Start
AutomaticStartDelay: 30
AutomaticStopAction: Shutdown
- Name: XXXAPP
State: Running
AutomaticStartDelay: 60
AutomaticStopAction: SaveDatum.yml (Excerpt)lookup_options:
HyperVState:
merge_hash: deep
HyperVState\VMMachines:
merge_hash_array: UniqueKeyValTuples
merge_options:
tuple_keys:
- Name