You are currently viewing Week 1 – Add multiple PowerShell variables to Ivanti Automation parameters

Week 1 – Add multiple PowerShell variables to Ivanti Automation parameters

In week 1 of the new item Tip of the Week, I will discuss the option to add more PowerShell output variables to multiple Ivanti Automation parameters.

A video recording can be found below the blog and shows the full process described in this blog.

With Ivanti Automation a task to execute PowerShell scripts is available. The task provides an option to add the output of a PowerShell script into a variable. This option can be found in the Settings tab of the Execute PowerShell task.

A predefined parameter can be selected or a new parameter can be created. This option only supports one output but what if we have a script that gives multiple outputs which need to be added to different Ivanti Automation parameters?

Below is a simple PowerShell script that searches for the FullName of a user and in which OU (Organizational Unit) the user resides.

$UserInfo = Get-ADUser -Identity $[username] -Properties Name | Select-Object UserPrincipalName, Name

$Global:UPN = $UserInfo.UserPrincipalName
$Global:FullName = $UserInfo.Name

Steps creating the Ivanti Automation Module:

  • Create a new Module
  • Select the option Add
  • Search for the Windows PowerShell Script (execute)
  • Add a PowerShell in the Script tab
  • For this specific script create 3 parameters (username, UPN and FullName). Check the screenshots below how to configure the parameters

username parameter:

UPN and FullName parameters (because we will request the values with the PS Script the When scheduling Job input must be disabled)

The script contains 2 lines a starting with $Global:
$Global:<Automation Parameter> = <PS variable>

With the Global option, multiple script outputs can be added to multiple Automation parameters.

After scheduling and executing the module the result is shown in the screenshot below:

Check the recording how to build the PowerShell Variables Module.

This Post Has One Comment

  1. fczekalski

    Would this work if you wanted to do like a output of a server list as a $var ./??

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.