vCommander has built in features for setting resource options, including CPU and Memory, but in some cases, you may want to have a simple “T-Shirt size” option which lets you set the resource configuration with one form element. 

This article will walk through the process to set up the form element and script to enable this type of Service Request. Optional details for configuring a special cost model for the “T-Shirt Size” request are included but not required.


 Additionally, this script assumes you have connected a vCenter system to your vCommander install.

Create the "T-Shirt Size" Custom Attribute

The first step in configuring the T-Shirt Script is to create the T-Shirt Custom Attribute. This custom attribute must be created to allow you to select the “T-shirt” size when requesting a service.

  1. Log into your vCommander Admin console. Under the Configuration menu, click Custom Attributes. Click Add.
  2. On the Define Attributes page set the Custom Attribute as follows:

    Name: T-Shirt Size
    Type: List
    Applies To: All
    Edit in Service Portal: Enabled

  3. Click Next. On the Configure Attributes page add the following Values:

  4. Click Finish to save the new Custom Attribute.

Configure the T-Shirt Size script and Sizing File

A PowerShell script is used to re-configure the Virtual Machine when it is requested along with an XML file which is used to control the amount of resources assigned to each t-shirt “size”. To configure the script please do the following:

  1. Place the TShirt_Size.ps1 script file and the sizingFile.xml file in the Scripts folder on the root of the PC. This should be “C:\Scripts\”.
  2. The TShirt_Size.ps1 file will need modifications to be used. See the “Edit your settings here” section and edit the $vCommanderServer and $VCenterAddress values with the addresses of your vCommander and vCenter servers.
  3. The sizingFile.xml file is configured with default resource sizes which can be changed. The default sizes are:

    Small – 1CPU, 1GB RAM
    Medium – 2CPU, 2GB RAM
    Large – 4CPU, 4GB RAM

    You can change those options by editing the <CPU> and <Memory> values for each size in the file.

Create the Required Credentials Files

Several credentials files must be created to allow the scripts to connect to the vCommander server and the vCenter server. All the credentials should be placed in the “C:\Scripts\” folder along with the script files.

  • The vCommander Credential file should be named “vCommanderCreds.xml”
  • The vCenter Credential file should be named “vCenterCreds.xml”.

Instructions to create the encrypted credentials can be found in our support portal here.

Create the "T-Shirt Size" Service Request

Now that the required custom attribute is created we can create a Service Request which uses the T-Shirt Size attribute.

  1. Create a new Service. The service is named “Example T-Shirt Service” here. Click Next.

  2. Click Add and select the Template, Image or AMI option. Select a vCenter template, in this example we will select a Windows 2008 template. Click Add to Service and then Close. Click Next.

  3. On the Infrastructure tab of the Component page select the Add Workflow button. Name the Workflow “T-shirt Resize Workflow”. Click Next.

  4. On the Steps page, click Add and select the Execute Script item. In the Command Line box, enter the following and click Next and then click Finish:

    powershell.exe  -ExecutionPolicy Bypass &{C:\scripts\TShirt_Size.ps1 '#{}' '#{target.managedSystem.address}'}

  5. On the Component page, select the Attributes tab and click Add Attributes link. Select the T-Shirt Size attribute and click OK.

  6. Select the Form tab and add the T-Shirt Size form element from the Toolbox. Click Edit on that element and check the Required checkbox. Click Next.

  7. Click Next on the Deployment and Visibility screens, you can set the Deployment and Visibility options based on your preferences. 
  8. Click Finish to complete the Service Request configuration.

(Optional) Configure a Cost Model based on the T-Shirt Size Custom Attribute

In addition to simplifying the Service Request for a new VM the T-Shirt Size feature can be used to determine the cost of the Service using a specially created Cost Model. To configure that cost model, do the following:

  1. In the vCommander Admin Portal, select Configuration->Costs from the main menu.
  2.  Click New Cost Model. Name the new Cost Model as “T-Shirt Cost Model”. Select the Targets you want to apply the Cost Model to and click Next.
  3. Configure the Resources, Storage, Operating System and Support costs as per your normal cost model. The T-Shirt costs will be added to these costs, if you want to base the cost entirely off the T-Shirt Size then set the other costs on the Resources, Storage, Operating System and Support pages to $0.
  4. On the Custom page, select the “T-Shirt Size” custom attribute from the drop down and click the Configure button. Set the price for each attribute value (Small, Medium, Large) and click OK.

  5. On the VM Uptime and Summary pages, click Next and then click Finish on the Summary page.

Now your custom Cost Model is configured and when Service Requests are made, and the T-Shirt Size field is included, the cost displayed will include the custom T-Shirt Size cost values.