I got a question from Andrea this week:
We have some VMs under HyperV that are used for training during the day and we would like to setup a vbscript that could be called from windows scheduler that could start them up in the morning, and shut them down at the end of the day. Is this possible?”
Very good question. Thankfully Microsoft has put Hyper-V into WMI, making it quite simple to do this.
I have written a script you can call from the command line this:
The name is the name of your virtual machine
The three options are:
stop – stop the VM
forcestop – Force a shutdown of the VM (Could lose data)
You can download it from here:
You will need to rename it to .vbs after downloading.
Keep in mind that this needs to be run on the actual Hyper-V Server to work.
One more thing…Subscribe to my newsletter and get 11 free network administrator tools, plus a 30 page user guide so you can get the most out of them. Click Here to get your free tools