possible to auto shutdown hyper-v daily ?

Big Jim

Well-Known Member
Reaction score
183
Location
Derbyshire, UK
With the impending energy price increases over here in the UK, I am looking at cutting energy costs as much as possible.

On current rates it costs around £30 a month to run our in house server.
Had an informal quote today at around 5 times our current cost per kwh
It is a Dell R710 running hyper-v 2012 host.

Is there a way I could configure this to shutdown automatically everyday ?
 
With the impending energy price increases over here in the UK, I am looking at cutting energy costs as much as possible.

On current rates it costs around £30 a month to run our in house server.
Had an informal quote today at around 5 times our current cost per kwh
It is a Dell R710 running hyper-v 2012 host.

Is there a way I could configure this to shutdown automatically everyday ?

Create a scheduled task to run a Powershell script every night and then use the Stop-VM command to shut down the VM's first and then Stop-Computer to shut down the host?


 
I'll give that a go thanks.

My understanding is that if you run the command to shutdown the computer it automatically shuts down (or at least suspends) the VMs first ?
 
I'll give that a go thanks.

My understanding is that if you run the command to shutdown the computer it automatically shuts down (or at least suspends) the VMs first ?
I'm not sure if it throws up a warning if you try and shut down the host when the VM's are still running.

Found this page which goes in to a bit more detail about scripting a shutdown:-

 
Sounds like an opportunity for technicians around the globe to perform "energy audits" of corporate computing fleets. I know in the past I would disable a great deal of Windows built-in energy management options in order to eliminate problems and improve performance. Time to reverse that trend?
 
I'm not sure if it throws up a warning if you try and shut down the host when the VM's are still running.

Found this page which goes in to a bit more detail about scripting a shutdown:-

If I manually instigate a shutdown now, it will cleanly shutdown the VMs first, then when I reboot the machine the VMs come back up automatically, if I shutdown the VMs first then when I start the host server up again the VMs remain shutdown, and I have to use a powershell command to manually restart them.
 
Sounds like an opportunity for technicians around the globe to perform "energy audits" of corporate computing fleets. I know in the past I would disable a great deal of Windows built-in energy management options in order to eliminate problems and improve performance. Time to reverse that trend?
They are probably what is preventing parts of the grid from exploding overnight when "normal" energy use drops. :p
 
if I shutdown the VMs first then when I start the host server up again the VMs remain shutdown

There are 3 auto-start options, listed below, looks like you have option 2 set:-
  • Nothing – This one is pretty obvious. When the host is powered on, the VM will do nothing.
  • StartIfRunning – This setting will start the VM only if it was running when the host was stopped.
  • Start – This will cause the VM to always start up automatically no matter what state the VM was in previously.
 
Just here to point out that you do not have to shut the VMs down before you shutdown the host. Hyper-V will do all that for you so long as a proper shutdown request is sent to the host OS and all the guests have integration services properly installed.

in the same place as you define the startup behavior you can also define the shutdown behavior, be that hibernation or an actual shutdown.

So go make sure your VMs are set to auto start, configure a little bit of a delay to stagger them a bit so you don't overwhelm your poor server on reboot. And then your scheduled shutdown script is only to shutoff the host itself. Save the grey hair and bald spots.
 
Back
Top