Configure PowerShell Question Type

Last modified: July 12, 2022
You are here:
Estimated reading time: 1 min

Setting Information

  • Question Types
  • available since Release 4.4
  • BETA Status

Detailed Information

To configure PowerShell as a Question Type, configure your Service and choose “PowerShell” as a Type.

In Release 4.5, this feature is in BETA State

PowerShell Script

  • Choose a Script you want to execute. PowerShell Files need to be stored in your PowerShell Script Path.

Selection Type

  • Choose “Single” or “Multiple” Selection Type.

Something More

Since 4.5, you can transfer Values from the Service to the PowerShell Question Script to work with those Values.

We use the Built-In Initialize Data named “$au2matorhook” and transfer the result from the previous Question and the BuiltIn Data Parameters to this Parameter as JSON.

So, your first lines should be

param ($au2matorhook)
$jsondata = $au2matorhook | ConvertFrom-Json

And then $jsondata.**** has your Values stored.

So, for example, if you have a Question with the internal Name “CUser” you can get the Value with “$jsondata.CUser”

If you want to work with the Built-In Value, do it like this

$InitiatedBy=$jsondata.InitiatedBy

$Service=$jsondata.Service
$TargetUserId=$jsondata.TargetUserId

Return

Make sure your PowerShell Script returns a String so that the Value will be set in the Question as Answer.

If you Return anything else, we try to show the result as a Prepoluated Table, and you can select the Values.

Templates

See our GitHub Repo for our PS Templates:

https://github.com/au2mator/au2mator-PS-Templates

Was this article helpful?
Dislike 0

Title