Solved

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

Posted on 2014-11-17
10
842 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
  • 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Have you ever had a hard drive that you can't boot into, but need to change the registry? Here is the solution! This article guides you through accessing and editing a registry of a non-primary drive. To read registry information on a non-prim…
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…
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…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …

770 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