Skip to content

Latest commit

 

History

History
37 lines (24 loc) · 1.22 KB

ise-plugins.md

File metadata and controls

37 lines (24 loc) · 1.22 KB
description
Custom ribbon commands for use in the ISE.

ISE Plugins

You can include custom ribbon commands in the ISE to aid in improving the script authoring experience.

ISE Plugins

Add a custom plugin

For this example, we wish to have a plugin that analyzes the script and reports on any errors.

Create a new script stored under the following structure:

Analyze Script

{% hint style="info" %} The path structure needs to follow [MODULE]/Internal/ISE Plugins/[PLUGIN_NAME]. Here we have X-Demo/Internal/ISE Plugins/Analyze Script. {% endhint %}

Use the following sample to fill in the script body.

if([string]::IsNullOrWhiteSpace($scriptText)){
    Show-Alert "Script is empty - nothing to format."
    exit
}

Import-Module -Name PSScriptAnalyzer
Invoke-ScriptAnalyzer -ScriptDefinition $scriptText

Now you can run the command from the ribbon and see the results in the ISE.

Example results