Solved

How do I configure a Timed restart for Multiple Hyper-V VMs on Server 2012?

Posted on 2014-11-17
10
1,129 Views
Last Modified: 2014-11-19
How do I script a timed restarting of multiple VMs on Hyper-v 2012 Server. I have tested the restart process and found it needs to run in PowerShell running as administrator. I have tried to run a simple shutdown -r -f, and having task scheduler keep time. Help please.
0
Comment
Question by:technologyone
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
10 Comments
 
LVL 54

Expert Comment

by:McKnife
ID: 40448378
The restart can be done from inside the machines (task scheduler on each machine or task scheduler on one machine that does shutdown remote machines ->look at the options of shutdown.exe /?), or it can be done through the host - yes, powershell.

please articulate what problems you are seeing, it's very simple.
0
 

Author Comment

by:technologyone
ID: 40449624
I would like to run this from the host if possible. I have about 50 VMs and want easy modification for the future. I am having trouble scripting the Restart-VM in PowerShell to run as administrator. I know I am not doing something, but I am relatively new to scripting.
0
 
LVL 54

Expert Comment

by:McKnife
ID: 40449655
What trouble do you have?
The restart-vm has examples in its help, did you read those?
The vmhost could start a simple restart.ps1 script though task scheduler using system rights (the system account would be the executioner).
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

Author Comment

by:technologyone
ID: 40449983
In what I was reading it did not look like I could use a restart "all" type command.
0
 
LVL 54

Accepted Solution

by:
McKnife earned 500 total points
ID: 40450096
You can. Use the command
get-vm |restart-vm -confirm
0
 

Author Comment

by:technologyone
ID: 40450206
I have the script running like this...

restart-vm machine1 -force

This only works as long as it is directly in the task scheduler arguments section. If I put this script in a restart.ps1 file and insert this in the filed it errors out and I cant read the error before it is gone.
0
 

Author Comment

by:technologyone
ID: 40450228
Ok I have inserted the  " get-vm |restart-vm -force " on the Task Scheduler arguments line and it seems to be working. I will try it in production tonight. Thanks for the suggestion.
0
 
LVL 54

Expert Comment

by:McKnife
ID: 40450249
Turn on this policy: computer config - policies - adm. templates - Windows Components/Windows PowerShell - Execution Policy: Allow local scripts and remote signed scripts
0
 

Author Comment

by:technologyone
ID: 40450260
I will post tomorrow to close question after in production solution has run. Thank you again for the assistance.
0
 

Author Closing Comment

by:technologyone
ID: 40452247
I am closing this job. thanks
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

INTRODUCTION The purpose of this document is to demonstrate the Installation and configuration of the Data Protection Manager product. Note that this demonstration was prepared on the basis of Windows OS is 2008 R2 and DPM 2010. DATA PROTECTI…
Optimized for private cloud infrastructures and datacenters, Nano Server is minimalistic, yet super-efficient, OS for services such as Hyper-V and Hyper-V cluster. Learn how you can easily deploy Nano Server and unlock its power!
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…

738 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