Example of VM Clouds Automation runbook using variables

I am looking of any examples of using Runbooks in the SMA that have the ability to use variables that are been passed in from the VM Clouds runbook activity.

I have a runbook that i have created in the SMA that updates a value of the VM in service manager that works fine but i need to pass in the variable of the VM name.  This i am wanting to execute this runbook in the VM Clouds / automation part.  I can get my runbook to show up but i am unsure how to  pass the variable of the VM name to my runbook when it executes on VM create or what ever my targeting class.

Thanks looking forward to a reply.

Davey

December 5th, 2013 5:02pm

Great Question!

Add an input parameter at the top of your SMA Runbook:

param([object]$resourceObject)

From there, you will be able to get various pieces of data coming from the WAP/SPF Event that is configured through VM Clouds.

It depends on which event you are triggering off of, but a simple dump of the data in this $resourceObject should let you see what is available and how you can use it / pass it along.

-Charles

Free Windows Admin Tool Kit Click here and download it now
December 5th, 2013 9:29pm

Thanks for that Charles.

So the next crazy question is how do you get the dump of the objects out.  As you cant do a write-host as it is been run interactively.

I am trying to get the runbook to run on VM Delete or VM create.

Davey

December 5th, 2013 10:06pm

Output the $resourceObject in the Workflow. It will display all the data.

Actually, as it is an Input Parameter, it will show up in the Job results.

The real trick is getting the Runbook to trigger based on the event you have chosen. Has this been successful for you? Are you noticing Runbook jobs starting based on the events you have configured in VM Clouds - Automation?

Free Windows Admin Tool Kit Click here and download it now
December 5th, 2013 10:27pm

Hi Charles that is exactly what i am struggling with.

We have tried VMM Machine and SPF Machine.  

I am guessing that there is a trick that i am not doing :)  We are able to get the runbook to trigger via a script but when we call it from the VM Clouds nothing is seeming to be logged at all.

Davey

December 5th, 2013 10:45pm

I assume you are working with Standalone VMs from VM Templates within the WAP Portal? Or VM Roles?

How are these VMs being created?

I have had success with the MicrosoftCompute VMRole triggering at the start of VMRole creation.

Maybe try one of the MicrosoftCompute... Object events?

Free Windows Admin Tool Kit Click here and download it now
December 5th, 2013 10:59pm

Standalone VM's from Templates.

Creating using WAP and quick Create and select a published Template.  

Once the machine has been created and running then i want to trigger a task to update an attribute in Service Manager when the VM is deleted.

I will try the Compute VM role now :)

Davey

December 5th, 2013 11:08pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics