PhenixID

Get Objects from Powershell Command

Version: 1.0

Category: Input

Extended Category: Powershell

Action Package: Standard Actions

Description

Run a powershell command and create session objects for the result. The powershell command must write it’s result to a file with character encoding UTF8. The result must be one or multiple PSObjects in list format. Use [OUTPUTFILE] for file name.

Parameter

Description

Example

PowerShell File Path

File path to PowerShell.exe. Default: file path in Global Parameter POWERSHELL_PATH. It is mandatory to set either this parameter or the global parameter.

C:\Windows\System32\Windows\PowerShell\v1.0\powershell.exe

PowerShell Command

[Mandatory] The Powershell command. The command must write it’s result to a file with character encoding UTF8. The result must be one or multiple PSObjects in list format. Use [OUTPUTFILE] for file name.

Get-ADUser -Identity SESSION(uid) | Out-File [OUTPUTFILE] -encoding UTF8

Only Run Once (true/false)

[Optional] If the powershell script should run once and not one time for each object in the session. If using SESSION() in command, the values from the first session object will be used when running only once. Default value=true.

false

Max Execution Time (secs)

[Optional] The maximum number of seconds the script/command can run before being forced to terminate. Use 0 for unlimited time. Default value=0 (unlimited).

30

Error Message Attribute

[Optional] If the Powershell script returns any error, the message will be placed in this attribute. If no error, the attribute will be created with no value. Leave blank to not create any error message attribute.

ps-error

Replace Existing Session Objects (true/false)

[Optional] If the session objects from Powershell should replace all the existing session objects (true) or if they should be added to the list of existing session objects (false). Default: true.

false

Use Cases

Example 1: Run script with session attribute value

This action will run a command that uses a session attribute value. Therefor the script has to run once for each session object. The objects from Powershell will replace the original session objects.

The powershell file path has been entered in global parameter POWERSHELL_PATH.

Parameter

Value

PowerShell File Path

[BLANK]

PowerShell Command

Get-ADUser -Identity SESSION(uid) | Out-File [OUTPUTFILE] -encoding UTF8

Only Run Once (true/false)

false

Max Execution Time (secs)

[BLANK]

Error Message Attribute

[BLANK]

Replace Existing Session Objects (true/false)

[BLANK]


DISCLAIMER
Information provided in this document is for your information only. PhenixID makes no explicit or implied claims to the validity of this information. Any trademarks referenced in this document are the property of their respective owners.

The origin of this information may be internal or external to PhenixID. PhenixID makes all reasonable efforts to verify this information.

PhenixID - support.phenixid.se