Share via


Orchestrator – Check System Center VM Snapshots

Often a Sysadmin creates a checkpoint (snapshot) of the VM before they doing some changes. A Servicedesk wants to monitor those snapshots so they don’t get to big or even stays there for ever. We used Orchestrator to create a simple check against the VMM Server and send out a mail with the current snapshot overview.

We achieved this by creating a runbook with 2 simple steps:

http://sysctr.nl/wp-content/uploads/2013/12/image_thumb9.png

First we run a Powershell script. and output this to a e-mail.

When we take a closer look at the Powershell script we created, as follows:

http://sysctr.nl/wp-content/uploads/2013/12/image_thumb10.png

The script contains the following lines: 

$vmcheck = Get-VM | where {$_.LastRestoredVMCheckpoint -like “* *”}
 
[string]$body = “<table border=0>`n”
 
$body += “<tr><td>Name</td><td>CheckPoint</td><td>Location</td></tr>`n”
 
  
 
foreach($vm in $vmcheck) {
 
$body += (“<tr><td>{0}</td><td>{1}</td><td>{2}</td></tr>`n” -f ($vm.name,$vm.LastRestoredVMCheckPoint,$vm.CheckPointLocation))
 
}
 
$body += “</table>`n”

For the email template we created a html with the following lines. The bold part should be a published data from the script:

<html>
 
 <head>
 
  <title>Snapshot Overview</title>
 
 </head>
 
 <body>
 
  <p>
 
   <img src=http://www.ourwebsite/images/logo.png align=left/>
 
   <img src=http://www.ourwebsite/images/microsoft.jpg align=right/>
 
   <br/><br/><br/><br/>
 
   <center><h2 font face=”Segoe UI Light”>Virtual Machine Snapshot Overview</h2></center>
 
  </p>
 
  <br/><br/><br/><br/>
 
  {Output Variable 01 from “Run VMM Powershell Script”}
 
 </body>
 
</html>

When we start the runbook tester and click run we got a e-mail with an overview of the Virtual Machines having a snapshot:

http://sysctr.nl/wp-content/uploads/2013/12/image_thumb11.png

I like to use SCOJobRunner for scheduled runbook activities what I defined on my Runbook Server. I created a new scheduled task and assign the runbook ID from the runbook we just created to run every day at 6:45am Orchestrator – Check VM Snapshots

http://sysctr.nl/wp-content/uploads/2013/12/image_thumb12.png

Source: SysCtr Blog