Tablets How to monitoring Hype-V Guests with PowerShell and Bat | BLOG IT

How to monitoring Hype-V Guests with PowerShell and Bat

If you need to monitor your Hyper-V Guest VM in order to know that always is running, you could do it with a simple PowerShell script which could be executed through a Bat file which runs within Schedule Task. This script must run in the Host Hyper-V Server.

Here is the code on the BAT File:


This Script mix the Batch file property FINDSTR  and PowerShell property GET-VM, the first searches on the second the Word in this case "Running"  after that an IF sentence determines what to do, once the FINDSTR does not find the "Running" word it executes the ELSE, in this case it could be to send an email through VBscript  or could be to Start again the VM or whatever other action you need.

You only need to substitute VMname for your VM Guest.

You could add several entries with different VM's in order to monitor more servers.

This is script is very helpful because in some situations the VM stops i.e. the Host is running out of disk space, if that situation is present you could be alerted.
SHARE

About Robert SA

    Blogger Comment
    Facebook Comment

0 comentarios: