You can include custom ribbon commands in the ISE to aid in improving the script authoring experience.
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:
The path structure needs to follow [MODULE]/Internal/ISE Plugins/[PLUGIN_NAME]
. Here we have X-Demo/Internal/ISE Plugins/Analyze Script
.
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 PSScriptAnalyzerInvoke-ScriptAnalyzer -ScriptDefinition $scriptText
Now you can run the command from the ribbon and see the results in the ISE.