Getting Started: vRealize Orchestrator Script Environments [CB10098]

  1. Introduction
  2. Prerequisite
  3. Procedure
  4. Calling modules & variables
    1. For Node.js
    2. For Python
    3. For PowerShell
  5. Sample Node.js Script


Do you use a lot of Polyglot scripts in vRO? Are you tired of creating bundles every time you work on a Python, Node.js or PowerShell script which uses modules and libraries which are not provided out-of-the-box by vRealize Orchestrator? Probably vRO guys at VMware heard your prayers this time.

vRO 8.8 onwards, you can now add modules and libraries directly as a dependency in your vRO actions and scriptable tasks. How cool is that!

As we know, in earlier versions, you could only add dependencies by adding them as a ZIP package which is not only a tiring additional steps, but also, editing and understanding those scripts becomes a real nightmare. But not any more.

In this post, we will see a detailed procedure on how to setup an script environment in your vRO (>8.8). I am going with Node.js but almost similar process can be followed for other languages as well. We will use an advanced date & time library called MomentJS available at but you can use any other module or library of your choice for that matter.

Note Similarly to other vRealize Orchestrator objects such as workflows and actions, environments can be exported to other vRealize Orchestrator deployments as part of a package, which means they are also a part of version control.


  • vRealize Orchestrator 8.8 or greater


  • Log in to the vRealize Orchestrator Client.
  • Navigate to Assets > Environments, and click New Environment.
  • Under the General tab, enter a name for your environment.
  • (Optional) Enter a description, version number, tags, and group permissions for the action.
  • Under the Definition tab, Click on Add button under Dependencies.

You can also change the Memory Limit to 128, 512, 1024 etc. depending on the number and size of packages that you will be using. In my personal experience, using PowerShell modules will require more than default.

  • Provide the package name and version that you want to install. For Node.js, passing latest will get you the most recent package.

Tip The package name is same as what you would use with package managers like npm while installing that package.

  • Once you click Create button, you should see Environment successfully created.
  • Under the Download Logs tab, check if the libraries are already installed.

Here, I have installed two modules, moment and moment-timezone as you can see from the logs.

  • In the Environment variables, you can provide a variable that you want to use as a part of this environment.
  • Create an action or a workflow with scriptable item, Select Runtime Environment as the one that you have created. I have selected moment.
  • Play with your script. Don’t forget to call the modules and environment variables.

Calling modules & variables

For Node.js

const myModule = require('moment');
const envVar = process.env.VAR_NAME;

For Python

import myModule

For PowerShell

Import-Module myModule

Sample Node.js Script

exports.handler = (context, inputs, callback) => {
//——————-Don't edit above it————————//
const moment = require('moment'); // **IMPORTANT**
const tz = require('moment-timezone'); // **IMPORTANT**
const indianTimeZone = process.env.TIMEZONE_IN; // import Env variable in Node.js
console.log(moment().format('MMMM Do YYYY, h:mm:ss a'));
console.log(moment().format("MMM Do YY"));
console.log(moment().format('YYYY [escaped] YYYY'));
var jul = moment("2022-07-20T12:00:00Z");
var dec = moment("2022-12-20T12:00:00Z");
console.log('America/Los_Angeles').format('ha z')); // 5am PDT
console.log('ha z')); // 4am PST
//——————-Don't edit below it————————//
callback(undefined, {
status: "done"

That’s it on this post.

List of PowerShell Modules in vRO 8.x

Here is the list of all the PowerShell Modules that comes preinstalled in vRO 8.x. In later versions of vRO, we have 2 PowerShell environments 6.x and 7.x. There is a slight difference in the modules as you can notice below in both the versions.

For Powershell 7.xFor Powershell 6.x

As you might have noticed, in 7.x, we have two additional modules i.e. VMware.CloudServices & VMware.VimAutomation.WorkloadManagement, but misses out PSDesiredStateConfiguration that is only available in 6.x.

Check out other list of modules here:

for Python:

for NodeJs:


How to publish your PowerShell script to PSGallery online

You ever created a PS script and wanted it to share. What best place would it be other than the PowerShell Gallery itself!

Let’s go through this article to know how I listed my own PS script on PSGallery.

  • Click Create and provide Key Name = script_name and glob pattern = *
  • Now, I have my script ready with me. However, before uploading the script, I must add some metadata to my script like Author, Description, Version etc.
  • For that, I have used New-ScriptFileInfo method. I put the values as per my need and run them inside Powershell console.
$Parms = @{
  Path = "C:\Users\mayank.goyal1\Downloads\scriptInfo.ps1"
  Version = "2.1.0"
  Author = "Mayank Goyal"
  Description = "This script converts vRO Package directly into JSDoc website by connecting to vRO. Requires nodejs and jsdoc module installed. Create new files *.html & *.js directly from vRO with JSDoc annotation. It consumes a package name which should exist in vRO with all the Actions you want to document and creates .js files with JSDoc Annotations."
  ProjectUri = ""
New-ScriptFileInfo @Parms
Get-Content -Path C:\Users\mayank.goyal1\Downloads\scriptInfo.ps1
  • This creates a new file C:\Users\mayank.goyal1\Downloads\scriptInfo.ps1. Opening this file show me this content.

.VERSION 2.1.0
.GUID 7202df73-3b8c-4616-adeb-b6d9b97a63c7
.AUTHOR Mayank Goyal
 This script converts vRO Package directly into JSDoc website by connecting to vRO. Requires nodejs and jsdoc module installed. Create new files *.html & *.js directly from vRO with JSDoc annotation. It consumes a package name which should exist in vRO with all the Actions you want to document and creates .js files with JSDoc Annotations. 
  • Copy this file’s content and put it on top of your original script.
  • Now, it’s time to publish our file. Use Publish-Script command along with file path and API key that I have handy already.
Publish-Script -Path "C:\Users\mayank.goyal1\Downloads\vRODoc.ps1" -NuGetApiKey oy2hxalemh46n4ghty*****************************64 -Repository PSGallery
  • This should have worked, but it didn’t. Got this error no matter from where I run it.

Failed to publish script ‘vRODoc’: ‘The underlying connection was closed: An unexpected error occurred on a send.

  • The first problem might be that my system runs TLS11 instead of TLS12, to fix this run the following command:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12

The second problem might be that my PowerShellGet Module is not up to date. To fix this I run the following command:

Install-Module PowerShellGet -Force -AllowClobber -Scope CurrentUser
  • Restart PS terminal and run this command again. This time it worked.

BINGO! It’s published for anyone to use.