New video: Windows 10 Hyper-V Virtual Machine Shortcut - How to Start, Run and Shutdown a Hyper-V vm from a single Shortcut.
Shows how to create a PowerShell script to start (boot) a vm, open it, and finally shut down simply by closing the vm window. Really practical way to run Hyper-V virtual machines: double click the shortcut to boot and open it, close the vm window to automatically shutdown.
The PS script:
Start-VM "VM Name"
C:\Windows\System32\vmconnect.exe localhost "VM Name" | Out-Null
Stop-VM "VM Name"
Command to run the script or add to a shortcut:
powershell.exe "& ""Path&Name_of_the_Script.ps1"""
The VB script, to run the PS script without showing the PowerShell window:
command = "powershell.exe -nologo -command Path&Name_of_the_Script.ps1"
set shell = CreateObject("WScript.Shell")