I had the following requirement that I wanted to automate

Based on an event in Vcenter ( high CPU ) I wanted to change the network properties of a particular VM.

VMWare has tasks to start a new VM , clone etc, but there is no way to change the network properties of an existing VM based on an event.

I used the following technique to solve this

  • The Vcenter generates an event when the VM goes above a certain % CPU. We can set an batch file to execute for example.
  • The batch file calls on a powershell script to execute
  • The powershell script makes a restapi call to UCSD to execute a script
  • The UCSD uses one of the many pre-defined task to make changes in vcenter ( change the network properties of a different VM ).


The remaining part of the blog is focused on the powershell and the UCSD.

Begin by reading the REST API cookbook



Method 1

Use a REST call directly from Powershell. It's just a few lines of code.

Below is the power-shell script

$r='http://<ipaddress of UCSD > /app/api/rest?opName=userAPISubmitWorkflowServiceRequest&opData={param0:"<workflow name >",param1:{},param2:-1}'

$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"

$headers.Add("X-Cloupia-Request-Key", '28D238CA334F45FB8E9EBBE17101480C')


Invoke-RestMethod $r -Headers $headers


Follow the steps below to how to get the REST key.

Cisco UCS Director REST Developer Guide, Release 5.3 - Getting Started [Cisco UCS Director] - Cisco


Method 2

Use the Powershell cmdlets that create a wrapper around the REST calls

Cisco UCS Director PowerShell API User Guide, Release 5.0 - Working with Cmdlets [Cisco UCS Director] - Cisco