Skip to the main content.

ScriptRunner Blog

Improved and Enhanced PowerShell Reports

The execution of any PowerShell script with an action generates a report in ScriptRunner.

In existing versions, the report includes the Metadata blocks, the list of parameters with which the script was ultimately executed, and PowerShell output.

Post Featured Image

This article has been translated automatically.

The execution of any PowerShell script with an action generates a report in ScriptRunner. In existing versions, the report includes the Metadata blocks, the list of parameters with which the script was ultimately executed, and PowerShell output.

In version 2016 the reports will be further expanded. In addition to the blocks mentioned above, there is now also an error block in which the errors that occurred or led to an abort are summarized, as well as an output block.

The function and the use of the output block in the apps will be introduced in a later part. But this much in advance: the output block can be used to control result output both in the report and in the app.

For this, a global ScriptRunner variable $SRXEnv.ResultMessage is provided, which can be filled depending on the script logic.
Example

$SRXEnv.ResultMessage = “The user ” + $username + “was created successfully with ” + $mailaddress + “”

The global result variable can be assigned different result types like strings, tables, arrays etc., which will be converted to OutString for display in the report and in the UI.

The two illustrations show the report extensions with error and result blocks.

Report from PowerShell executions

PowerShell Reports: Comparison of Executions

In addition, the comparison function for comparing two reports has been reworked so that very different reports can now be compared exactly in the order in which they are output.

 

Related posts

2 min read

VMUG Webcast: Mastering VMware Management with PowerCLI

3 min read

Automate your spring cleaning with PowerShell

5 min read

Mastering PowerShell with Get-Help

About the author: