5.5.2

Table Of Contents
Workflow Name Description
Toggle virtual machine state Toggles the power state of a virtual machine.
Access the PowerShell Plug-In API
Orchestrator provides an API Explorer to allow you to search the PowerShell plug-in API and see the
documentation for JavaScript objects that you can use in scripted elements.
Procedure
1 Log in to the Orchestrator client as an administrator.
2 Access the API Explorer from either the Orchestrator client or from the Scripting tabs of the workflow,
policy, and action editors.
n
To access the API Explorer from the Orchestrator client, click Tools > API Explorer in the
Orchestrator client toolbar.
n
To access the API Explorer from the Scripting tabs of the workflow, policy, and action editors, click
Search API on the left.
3 To expand the hierarchical list of PowerShell plug-in API objects, double-click the PowerShell module
in the left pane.
What to do next
You can copy code from API elements and paste it into scripting boxes. For more information about API
scripting, see Developing with VMware vCenter Orchestrator.
Working with PowerShell Results
You can use objects from the API of the PowerShell plug-in to work with results that Windows PowerShell
returns.
You can use the methods from the PowerShellInvocationResult class to get information about a script that
you run.
Method Description
getErrors()
Returns a list of errors reported by the PowerShell engine during script invocation.
getInvocationState() Status of the script. The possible values are Completed or Failed.
getHostOutput()
Output of the script as it appears on the PowerShell console.
getResults()
Objects returned by the PowerShell engine. The returned object is of type
PowershellRemotePSObject.
PowershellRemotePSObject is a remote representation of objects returned by the PowerShell engine.
PowershellRemotePSObject contains XML serialization of the result that can be accessed by calling the
getXml() method.
The PowerShell plug-in also provides an object model that wraps the XML result and provides easier access
to particular object properties. The getRootObject() method provides access to the object model. In general,
the getRootObject() method maps the PowerShell types to types available in Orchestrator, by using the
following rules.
n
If the returned object is of a primitive PowerShell type, the object is mapped to the corresponding
Orchestrator primitive type.
n
If the returned object is of type collection, the object is represented as ArrayList.
n
If the returned object is of type dictionary, the object is represented as Hashtable.
Using VMware vCenter Orchestrator Plug-Ins
124 VMware, Inc.