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.

Limitations

None.

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.

Custom Property Configuration Values

You use these options to create the custom property. For the general steps, see Create a vRealize Orchestrator Action Custom Property Definition.

Table 1. PowerShell Script Custom Property Configuration Values

Option

Value

Name

You can use any string.

Data type

String

Display as

Dropdown

Values

External

Action folder

com.vmware.vra.powershell

Script action

Select an action based on where the PowerShell script is located.

  • 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.

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. For example,

Blueprint Configuration

To add the custom property to the blueprint Properties tab, see Add a Custom Property or Property Group as a Blueprint Machine Property.