PowerShell Script Custom Property Definition

<

You add a custom property to run a PowerShell script when you want to use a script to retrieve data to populate the custom property in the request form. The PowerShell script custom property uses a vRealize Orchestrator action to run the script and retrieve the values.

For example, as the cloud administrator you have a PowerShell script that retrieves user IDs from the Active Directory that is registered with vRealize Automation. The intent of the script is to retrieve and display John Smith when the actual value in Active Directory is JSmith01.

An advantage to using the PowerShell script action includes a central location for the script. You can either store the script on a central server and then run it on target virtual machines, or you can store it in vRealize Orchestrator and then run it on the target machines. A central location decreases maintenance time. Storing the scripts in vRealize Orchestrator when you have backup and restore configured ensures that you can restore the scripts if a system failure occurs.

Prerequisites

Verify that you have a working PowerShell script that returns key pair values. The script must be available on an accessible server or that the script is uploaded into vRealize Orchestrator.

If the PowerShell script is on a central server, use executeExternalPowerShellScriptOnHostByName.

If the PowerShell script is uploaded into vRealize Orchestrator, use executePowershellScriptFromResourceOnHostByName.

These script actions are example scripts. You can create specific actions for your environment.

The Resources/Sample/vRA/PowerShell/countries.ps1 sample PowerShell script is provided in the vRealize Orchestrator client as reference for use with the executePowershellScriptFromResourceOnHostByName action.

Input parameters

Configure the input parameters based on the selected action.

Define parameters

If you use executeExternalPowerShellScriptOnHostByName:

hostName. Name of the central server where the script is located.

externalPowershellScript. Path to the PowerShell file on the host.

Arguments. Parameters to pass to the script. You separate the arguments with commas. For example, Argument1,Arguement2.

If you use executePowershellScriptFromResourceOnHostByName:

vRealize Orchestrator. Name of the vRealize Orchestrator instance you are using as the host.

scriptResourcePath. Path to the PowerShell file on the host.

scriptResourceName. Path to the PowerShell file as an uploaded resource in vRealize Orchestrator.