Deployment recommendations by VMTurbo (Part 2)

Blog Post created by lingenavd on Mar 3, 2015


In part 1 of this article I described the advice offered by the VMTurbo Customer Success team regarding the creation of the necessary groups, templates and deployment profiles from the GUI. As a result we succeeded to get some recommendations from the Deploy Tab in the VMTurbo GUI.

In this part 2, I will describe my efforts to automate the recommendations from Powershell using the REST API services as part of a System Center Orchestrator Runbook (or you could use them on their own).

I am using the same groups, segments, templates and deployment profiles as described in part 1.



My starting point was the following support article:\

For everything in that article that is done in the Bash command prompt, I want to be able to execute it with Powershell in combination with the REST API services.


Let’s get started:


  • This is successfully implemented on VMTurbo Operations Manager 5.1.
  • It may work (or not) on prior versions.
  • The credentials used in these API calls should have either Administrator or Automator permissions.


This tutorial provides an example of how to get recommendations for VMs from Powershell scripting. When you execute the Powershell snippets, remember to replace the credentials and server IP address in each snippet.


Step 1: Find the template for which you want to get a placement recommendation from VMTurbo.


Snippet: to get the Bronze template from VMTurbo


$cred = Get-Credential

$VMTurbo = "10.10.x.x"


$output_templates = Invoke-RestMethod -Credential $cred -Uri http://$VMTurbo/vmturbo/api/templates

$template_AutoDeploy_W2012R2_Bronze = $output_templates.TopologyElements.TopologyElement | where {$_.displayName -imatch "AutoDeploy-W2012R2-Bronze"}

write-host "Template:"


Output from script:


The bold line that starts with “uuid” contains the UUID for the Bronze template as the value the bold line that starts with “services” contains the UUID for the associated deployment profile.




accessSpeedConsumed       : 0.0

cpuConsumedFactor         : 0.5

creationClassName         : VirtualMachineProfile

description               : Bronze - 1 CPU -1 GB mem - 60
GB C: disk

displayName               : AutoDeploy-W2012R2-Bronze

ioThroughputConsumed      : 0.0

memConsumedFactor         : 0.75

model                     :

name                      : VirtualMachine::AutoDeploy-W2012R2-Bronze

networkThroughputConsumed : 0.0

numVCPUs                  : 1

price                     : 0.0

services        : _lFzk8J_0EeS61qwVCX7Lsw

storageConsumedFactor     : 1.0

uuid            : _LcCnYJ_yEeS61qwVCX7Lsw

vMemSize                  : 1048576.0

vStorageSize              : 61440.0

vendor                    :


Step 2: Find the deployment profile that is associated with the Bronze template.

Although the UUID for the deployment profile is already provided in the output of the snippet in step 1, I want to give you a snippet that gets the other properties from the associated deployment profile.


Snippet: to get the associated deployment profile for the Bronze template from VMturbo

Replace the variable $UUID_deploymentProfile in following in the snippet below for the value found for services in the output of the snippet in step 1.


$cred = Get-Credential

$VMTurbo = "10.10.x.x"


$UUID_ deploymentProfile = "_lFzk8J_0EeS61qwVCX7Lsw"


$output_deploymentprofiles = Invoke-RestMethod -Credential $cred -Uri http://$VMTurbo/vmturbo/api/deploymentprofiles

$output_deploymentprofile = $output_deploymentprofiles.TopologyElements.TopologyElement | where {$_.uuid -imatch $UUID_

write-host "DeploymentProfile:"



Output from script:


the bold line that starts with “uuid” contains the UUID for the associated deployment profile




creationClassName    : ServiceCatalogItem

discovered           : false

displayName          : AutoDeploy-W2012R2-V98-ZWL

name                 : AutoDeploy-W2012R2-V98-ZWL

uuid           : _lFzk8J_0EeS61qwVCX7Lsw

uris                 :

scope                : 398d5c971be49a244eff6f56d0e1789f6e77ffac

TopologyRelationship : TopologyRelationship


Step 3: Request placement recommendations for where you should deploy the VMs


  • The templateName is the uuid from step 1 (bolded)
  • The deploymentProfile is the uuid from step 2 (bolded)
  • The count is the number of VMs you would like to deploy (maximum is 25). In this example, we chose 2.
  • The reservation name to reflect the placement on NR or SR storage (NR_Deploy, respectively SR_Deploy)



Although the API will return immediately, the server internally can take 30-60 seconds to make these decisions, depending on how many VMs you are attempting to place.

The API will return another UUID that is associated with the requested recommendation.

In step 4 we use that UUID to get the actual recommendations.


Snippet: to request placement recommendation on NR data stores on cluster 1


$cred = Get-Credential

$VMTurbo = "10.10.x.x"


$reservationname = "NR_Deploy"

$count = 2

$templatename = "_LcCnYJ_yEeS61qwVCX7Lsw"

$deploymentprofile = "_lFzk8J_0EeS61qwVCX7Lsw"

$uri_create_res = "http://$VMTurbo/vmturbo/api/reservations?reservationName=$reservationname&count=$count&templateName=$templatename&deploymentProfile=$deploymentprofile"


$output_create_reservation_for_VM = Invoke-RestMethod -Credential $cred -Uri $uri_create_res -Method POST


write-host "Output Reservation:"



Output from script:


Output Reservation:




Step 4: Get placement recommendations based on the request UUID from step 3


Snippet: to get the placement recommendation


$cred = Get-Credential

$VMTurbo = "10.10.x.x"


$output_create_reservation_for_VM = "_pEzYwbarEeSOaZQTqkRL6Q"

$uri_res_result = "http://$VMTurbo/vmturbo/api/reservations/$output_create_reservation_for_VM"

$output_reservation_UUID = Invoke-RestMethod -Credential $cred -Uri $uri_res_result

Write-Host "Reservations:"

$output_reservation_UUID.VirtualMachines.ActionItem | ft –AutoSize

Output from script:



datastore      : NR_GOLD_002F_cluster1

datastoreState : Recommended

host           : ESXHost1.local

hostState      : Recommended

name           : NR_Deploy_C0

status         : OK

user           : XXXXX

vdc            :

vdcState       :


datastore      : NR_GOLD_0021_cluster1

datastoreState : Recommended

host           : ESXHost2.local

hostState      : Recommended

name           : NR_Deploy_C1

status         : OK

user           : XXXXX

vdc            :

vdcState       :

Et voila, here you have the ESX hosts and data stores where you should deploy your VM’s.

Normally I would do this only for one VM, then you get one recommendation.


The last thing you could do if you have just requested a placement recommendation for one VM:


$recommended_datastore = $output_reservation_UUID.VirtualMachines.ActionItem.datastore

$recommended_ESXHost = $

The variables will then contain the data store, respectively the ESX host where to deploy the VM.


I hope this can help you to automate deployment recommendations via Powershell scripting.


With regards,

Andre van der Lingen

System Manager at SNS Bank