• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 508
  • Last Modified:

How to restart a Hyper-V hosted virtual machine

Good afternoon Experts

We have a Hyper-V server that hosts 50 Windows 7 based virtual machines for our IT classrooms to use. What I would like to do is schedule a reboot of all 50 - either by shutting them all down and the "switching" them back on, or a reboot.

Is it possible to write a batch file/power shell script to do this for us, which can then go into Windows scheduler?

With thanks.
1 Solution
If these machiens are in a domain, you can make a cmd/bat script like this running on the DC:

shutdown -r -t 10 /m \\MACHINE_01_NAME /f
shutdown -r -t 10 /m \\MACHINE_02_NAME /f
shutdown -r -t 10 /m \\MACHINE_03_NAME /f
shutdown -r -t 10 /m \\MACHINE_04_NAME /f

and so on.

This script can be scheduled in task scheduler on the DC.

If all machines are in a workgroup, we need to work on a hyperv restart script.
Darius GhassemCommented:
Here is a script that will allow you to stop and start VMs in Hyper-V


Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now