I want to set up a Windows 10 VM on my workstation from an available VHD from Microsoft.
I’ve got a PSH script that will download the VHD and create the VM in Hyper-V. Check.
Before I use the VM, I want to make sure my favorite development applications are installed and some required network and security configurations and applications are installed. The latter, at least, require certain batch and PowerShell scripts to run.
I can mount the VHD and copy the scripts to the VHD for the VM from PowerShell. Check.
When I launch the VM I can manually run the scripts in the VM and they install and configure things, when run with the right administrative privilege. That’s OK, but not ideal. I want this to be fully automatic, so when I log into the VM for the first time then the applications and configurations are either already in place or launch automagically in the background and everything is soon in place.
Examples of the customizations to the base image:
- Install the latest Chrome (install without user input)
- Install a particular VPN we use, which requires a bunch of PowerShell
configuration changes in administrative mode before the installer
will work correctly
- Install WinMerge
I have not worked deeply with automating the configuration of Windows workstations in ages nor with Hyper-V VMs, so I’m not even sure if the approach is to put scripts in a magic startup folder or to set registry keys in the VM or some other VM setup hack that is quite unknown to me.
Any ideas how to pull this off with PowerShell and maybe a little batch?