How to restart a Hyper-V hosted virtual machine

Posted on 2011-10-07
Last Modified: 2012-05-12
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.
Question by:mgosden33
    LVL 6

    Accepted 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.
    LVL 59

    Expert Comment

    by:Darius Ghassem
    Here is a script that will allow you to stop and start VMs in Hyper-V

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    I have been plagued with this issue more than once, shut down my Hyper-V VM using the Hyper-V manager native to server 2008 because of disk space issues. This VM in question holds our office Sharepoint Server, the Sharepoint Databases are backed up …
    From Coral's  "So You Want To Play With Computers" Series A bit of background first, so this story will make a little sense. One day, probably because he needed a good laugh, Finagle hooked me up with a church to upgrade/run their Media Booth.…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now