This article provides a solution for the automatic tear down and redeployment of a vCommander service based on a vCenter vApp using the Embotics vCommander REST API. In this example, Windows Task Scheduler on the vCommander application server is used as the scheduling mechanism, but any equivalent product on any system that can access the vCommander API will also work.
- vCommander 5.6.4 or later
PowerShell v4 installed on the vCommander application server
Embotics REST API PowerShell libraries (version 2.5 or later)
Virtual Service Classroom script
Preparing the Service
- with a single Virtual Service (vApp) component
or with one or more components configured to deploy as a Virtual Service (vApp)
Additionally, it's recommended that you create a local vCommander user specifically for automation purposes. This way, you can make this type of service unavailable to users who might otherwise request it in error.
Creating the Scheduled Task
- Download the script and extract to a location on the vCommander server. In this example, we use c:\scripts.
- Login to the vCommander application server as a Windows administrator and launch Task Scheduler.
- In the Actions pane, click Create Basic Task.
- Provide a Name and Description. Click Next.
- Choose the Trigger. Click Next.
- Set additional scheduling options.
- Choose Start a program as your action. Click Next.
- Configure the next page as follows:
- Program/script: c:\scripts\vApp_Automation.ps1
- Add Arguments: -vCommanderServer 'your.vcommander.com' -VappName 'Classroom Two' -vCredFile 'c:\scripts\superuser.xml' -LogfileLocation 'c:\scripts\VappAutomation.log'
The arguments provide the following information:
vCommanderServer: The FQDN or IP address of the vcommander server
VappName: The name of the service to deploy, as it appears in vCommander's Service Catalog.
vCredFile: The location of the encrypted credentials file
LogfileLocation: The location of the file to which information and errors will be logged
Click Next then click Finish.