Back Story Back in January 2017 Craig and I made PowervRA available for macOS and Linux via PowerShell Core. It was always our intention to do the same thing for PowervRO and , although slightly later than we hoped, we’re finally able to do that. PowerShell Core has come a long way itself over the last year, currently in Release Candidate and soon to be GA, and I’m sure a lot of the hard work and community feedback which has gone into that has helped make the job of PowervRO supporting PowerShell Core very straightforward.
One of my colleagues showed me how to do this, so I thought it worth sharing since it has bugged me ever since I started using vRO. If you have run a vRO workflow and are looking at the output, specifically the Variables tab: you can then view what values each variable was at the time of workflow completion. If the value is a string or something else simple you will get a nice view of it.
This article on the vCOTeam site details how to mount a CIFS share on the vRO Appliance so that workflows can write files directly to a Windows File Share rather than using another process to copy the file over there. This was straightforward to implement in a lab scenario, however within a corporate environment with more restrictions around security and networking it can potentially be more of a challenge. Specifically we encountered the following error response from a Windows Server seemingly configured correctly for Share and NTFS permssions on the folder to mount:
vRealize Orchestrator doesn’t have an in-built Unit Test Framework, however I realised that it might be possible to use a combination of Pester and PowervRO for now to achieve similar results. Let’s take a look at an example using a very simple workflow, Workflow1. Workflow1 has two inputs, a and b, both numbers: Workflow1 has a single scriptable task that takes the inputs a and b, multiples them together and stores the result in c, which is output from the workflow.
When a file is imported into vRO to be used as a Resource Element, a MIME type is automatically set depending on what has been imported. For instance, in the below example a shell script has been imported, the contents of which will be used as part of some vRO automation - notice the MIME type has been set to application/x-sh. This doesn’t really cause a problem in itself when using the Resource Element in a workflow, however vRO doesn’t display the content of all MIME types when looking at the file in the Viewer tab and may display the message “cannot display this kind of element” instead - *.
One thing that I know colleagues and others are keen to automate with PowerShell and vRO is exporting and importing vRO packages. If you’re not familiar with a vRO package it is typically used to bundle up all of the Workflows / Actions / Configuration Elements / Resource Elements which make up the code for a particular project and use the package to transport the code to another system. So you may for instance wish to export a package and copy it to another vRO server or maybe into a version control system, or you may wish to automate the deployment of vRO itself and include importing the code as a final step.
Aside from any documentation around your vRO workflows, one of the best ways to quickly get up-to-speed with what it does and visualise how it is put together is to look at the schema. Wouldn’t it be handy if you could easily get hold of an image of the schema for one or multiple workflows? Well with PowervRO and your PowerShell console you can! The REST API supports this, so we have included a function Export-vROWorkflowSchema .
There are a number of different ways to get your developed vRO content from one system to another: exporting / importing single items, exporting / importing vRO Packages containing multiple items, synchronising content directly between vRO systems. In this example I’ll show you how to use PowervRO to export and import workflows from and to vRO. Export vRO Workflows To export a single workflow is pretty straightforward with the function Export-vROWorkflow:
In the previous episode we looked at how to invoke a vRO workflow with PowerShell, via PowervRO and the Invoke-vROWorkflow function. Once you have kicked the workflow off you are likely to then want to find out the state of the workflow, when it has finished and any output from the workflow. Here’s how to do this via PowervRO. Check the Workflow State: First of all, we need to identify which execution of a particular workflow we want to check the state of.
For the PowerCLI book 2nd Edition I helped put together a chapter on vRealize Orchestrator. Most of the chapter was focused on running PowerShell scripts from vRO, which was something I’d had a fair bit of experience with in projects I had been on and also thought would be what most people reading would be interested in. At the end of the chapter I added a few functions using the vRO REST API to run things in vRO from PowerShell as a bit of an after-thought.