VM Extras
In this section, we’ll outline a number of optional parameters you can use to modify for your VM.
Automatic Start
The following command controls how the hypervisor will handle starting the VM upon boot up.
Set-VM -VMName VMNAME -AutomaticStartAction NothingBelow are valid values and their described function.
| Value | Description |
|---|---|
| Start | Start the VM normally. |
| StartIfRunning | Start the VM only if the VM was running when the hypervisor was shutdown. |
| Nothing | Remain off, do not start the VM. |
Automatic Stop
The following command controls how the hypervisor will handle stopping a VM when requested to shutdown.
Set-VM -VMName VMNAME -AutomaticStopAction NothingBelow are valid values and their described function.
| Value | Description | Equivalency |
|---|---|---|
| TurnOff | Perform a hard shutdown of the VM. | To holding the power off button on a physical server. |
| Save | Save the VM’s state and shutdown. | To putting the VM to sleep. |
| Shutdown | Gracefully shutdown the VM. | To shutting down a physical server normally via the start menu. |
DVD Drive
The following command will attach and mount an ISO. Useful for installing operating systems.
# Local Path
Add-VMDvdDrive -VMName VMNAME -Path C:\Users\username\Downloads\installation_disk.iso
# Network Path
Add-VMDvdDrive -VMName VMNAME -Path \\SERVER\SHARE\installation_disk.isoBoot Order
The following commands will determine and set the DVD drive to be the first boot device.
$vmDVDDrive = Get-VMDvdDrive -VMName VMNAME
Set-Firmware -VMName VMNAME -FirstBootDevice $vmDVDDriveThe following commands will determine and set the network adapter to be boot from first on startup.
$vmNetworkAdapter = Get-VMNetworkAdapter -VMName VMNAME
Set-VMFirmware -VMName VMNAME -FirstBootDevice $vmNetworkAdapterEnabling/Disabling Integrated Services
An integrated service can be disabled using the Disabled-VMIntegrationService command:
Disable-VMIntegrationService -VMName VMNAME -Name "Time Synchronization"Enabling a integrated service can be completed through its counterpart command:
Enable-VMIntegrationService -VMName VMNAME -Name "Time Synchronization"See Microsoft’s Docs for a list of available integrated services.