Help Hyper-V Automation

Automate Actions for your Hyper-V servers

Automate the start, stop and restart of a Hyper-V VM(s) and ensure its continued performance.

Use Case: Automate Restart of VM using High CPU

Consider a company which runs an e-mail service served by a set of VMs. The requests to the e-mail service are shared based on the availability of the VMs. In case, a VM uses high CPU, it goes into an idle state. The requests managed by this VM are then transferred to the other active VMs. This way, almost all the VMs in the environment get filled up with requests and eventually bring the e-mail service down. 

Problem Statement:

One after another, the VMs are loaded with requests, halting the e-mail service. This might affect normal workflow and manual automation of each and every VM would be tedious and time consuming.


Choose to automate VM restart, when its CPU value exceeds the given threshold. Then, map the added automation with the CPU Usage threshold of the VM causing the issue using the pencil icon. For multiple selection of the VMs, click on the Threshold Configuration button and map the automation with the CPU Usage threshold. 

Add Automation

Supported from Windows agent 18.4.0 version and above. 

  1. Log in to Site24x7 and go to Admin > IT Automation Templates (+). You can also navigate via Server > IT Automation Templates (+).
  2. Select the Type of Automation as Hyper-V.
  3. Provide a Display Name for identification purposes.
    Eg: VM Restart 
  4. Choose the Action to be Automated: StartVM, StopVM, RestartVM.
    In the above case, you can select Restart VM.
  5. Select the Hyper-V Monitors having the VMs on which you want the automation to be executed.
  6. Select the VMs in those Hyper-V monitors where the automation has to be executed. You can select $FAILED_VM to execute automation for multiple failed virtual machines in one go.
  7. For the use case mentioned above, you can select the VM(s) using high CPU.
  8. Enter a Time-out period (in seconds) representing the maximum time period the agent has to wait for the automation execution to complete. Post that, there will be a time-out error. This will be captured in the email report, if configured as Yes.
    The time-out is set at 15 seconds, by default. You can define a time-out between 1-90 seconds.
  9. You can choose to Send an Email of the Automation Result to the user group(s) configured in the notification profile. By default, it is set to No. This email will contain parameters including the automation name, type of automation, incident reason, destination hosts, and more.
    If you've multiple automations executed in one data collection, a consolidated email will be sent.
  10. Save the changes.
Once an automation is added, schedule these automations to be executed one after the other.

Notification Profile Settings:

Configure the following settings in the notification profile:

  • Notify Down/Trouble status after executing IT automations associated to the monitor: When set to Yes, if your monitor still faces an outage even after executing the specified action, you'll be immediately alerted about the Down/Trouble status. 
  • Suppress IT Automation of dependent monitors: When the status of the dependent resource is Down, execution of the IT automation is not performed. 

Test Automation

Once you add an automation, go to the IT Automation Summary page (Server IT Automation Templates) and use the  icon for a test run. Read more.

The test run would be applied to all the hosts selected for Hyper-V automation. An exception to this would be selection of $LOCALHOST as the only host.

Click on the IT Automation Logs to view the list of automations executed by date.

Map Automation

For an automation to be executed, map it with the desired event. This can be done in two ways:

Related Articles

Was this document helpful?
Thanks for taking the time to share your feedback. We’ll use your feedback to improve our online help resources.

Help Hyper-V Automation