Automating new VM's in Hyper-V or "How I saved a bunch of time by switching to powershell automation"

When studying for certifications while also trying to maintain a healthy home and work life, time is often a limiting factor. When you only have a very small fraction of your week to construct and configure your lab environment, automation can be a life-saver. Enter automating Hyper-V virtual machine creation. My end goal was to have a web app that would take inputs of some parameters and then create a VM based on those. Realizing I was way in over my head with web dev skills lacking, I settled on a powershell GUI script instead. I started with a small script that would create a VM from a powershell console: $DCName = read-host "Server Name" $VHDPath = "C:\VM\$DCName\$DCName.vhdx" new-vm -MemoryStartupBytes 2GB -Generation 2 -NoVHD -Name $DCName Set-VM -name $DCName -ProcessorCount 2 New-VHD -Path $VHDPath -Parentpath "C:\VM\WinSrv2012R2\WinSrv2012Temp\WinSrv2012R2.vhdx" -Differencing Add-VMNetworkAdapter -VMname $DCName Get-vm $DCname | Add-VM...