Completion workflows in vCommander® are created to handle automation you wish to take place after a component or service has been deployed. Of the many types of steps available to administrators designing a completion workflow, this article will be concerned with the Execute Script step, and its particular use to install software packages.

Creating a Completion Workflow with Installation

The example here will be built around scripts and tools included in Embotics’ reference scripts, as used in a completion workflow configured to run when a new VM has been deployed. The example product is Symantec Antivirus, but the same process can be used with any installer that supports non-interactive installation.

  1. Download the reference scripts attachment to the vCommander application server.
  2. Extract the files psexec.exe and deployav.bat to C:\scripts\.
  3. Edit deployav.bat replacing <remote file server> with the actual network location where you are storing the files being called (%fileshare%\WIN_32Bit_Clients\SAV_WIN_32Bit_Clients_Setup.exe and%fileshare%\WIN_64Bit_Clients\WIN_64Bit_Clients_setup.exe).

Next, create a completion workflow which uses these files in a script step.
  1. Browse to Configuration > Service Request Configuration and switch to the Completion Workflow tab.
  2. Click Add.
  3. Provide a Name and choose to Apply this workflow: after a VM is deployed. Click Next.

  4. On the Steps page, click Add and choose Execute Script.
  5. Enter a Name for the step.

  6. Leave Step Execution set to Always Execute. Later in this article, we’ll look at a way to make it conditional based on choices users made when ordering the service.
  7. Set the Timeout value to 600 seconds to provide enough time for the installation to complete. You may have to tweak this setting based on actual timing in your environment.
  8. Set Script Output to Capture script output as comment.
  9. Set the When Script Fails action to Mark workflow step as failed: do not proceed.
  10. Add the following Command Line, replacing the Administrator credentials with those correct for your domain, and click Next: c:\scripts\psexec -i 2 -u <domain\administrator>-p \\#{target.ipAddress} -c -f c:\scripts\deployav.bat
  11. Choose to either Apply this workflow globally or Apply this workflow to selected components, choosing appropriate services. You’ll likely want to choose the later, unless the installers you will call are appropriate for all services. For example, selecting all Windows services and exclude those based on Linux. Click Next.
  12. Review your choices and click Finish.

Adding Custom Attributes for Installs

If you want to allow your customers to choose whether or not to perform an install using this completion workflow, the first thing you must do is create a custom attribute to provide the choice on the forms they are using.

  1. Browse to Configuration > Custom Attributes.
  2. Click Add.
  3. Name the attribute Install AV? or similar and provide a Description if you prefer.

  4. Choose Applies To: Form.
  5. Select List as the Type.
  6. Leave Edit in Service Portal checked. Click Next.
  7. Enter Yes in the text field and click Add. Repeat for No and then click Finish.

With the custom attribute created, the next step is to add it to the relevant forms so it’s exposed as a choice users can make.
  1. Browse to Configuration > Service Request Configuration and switch to the Form Designer tab.
  2. Select a VM component form that will be accessible by users to whom you want to provide this choice. The design view of this form appears in the center pane.
  3. Under the Toolbox pane, click Custom Attribute. A new Custom Attribute element is added to the design view pane.

  4. Select Install AV? from the list of Custom Attributes.Click OK.
  5. Click Save.

Now, when service portal users request a new VM, they will have to make the choice.

Making Installer Steps Conditional

As a last configuration, the workflow created earlier can be edited to make the step conditional, so that only those requests where the form field Install AV? was answered Yes will get the installation.

  1. Browse to Configuration > Service Request Configuration and switch to the Completion Workflow tab.
  2. Select the workflow created earlier and click Edit.
  3. Click Next.
  4. Select the Install Antivirus step and switch Step Execution to Execute when conditions are met. Click Edit.
  5. Add the condition #{request.service.settings.customAttribute['Install AV?']} -eq Yes and click OK.

  6. Click Next twice and then Finish.

See Also

vCommander also integrates with other systems to acheive custom installation options for generic services. See the current topics in our online help for more information: