ISE Addons, PowerShell, Scripting
comments 5

PowerShell ISE Addon: Yet another ISE function explorer

Fellow PowerShell MVP Jeff Hicks posted a nice script to find all functions and filters in an ISE script and show the same in a GUI dialog. Jeff used Regex to figure out the function and filter details. This got me thinking. Why can’t we do the same using PowerShell ISE scripting object model?

UPDATE: As Jeff pointed out in the comments, this works only with PowerShell 3.0. There is no -Passthru switch in PowerShell 2.0 for Out-GridView cmdlet.

In fact, the answer is yes.

In the above solution, I am using PowerShell tokenizer to find out the functions and filters.

However, this won’t give us the names of the functions or filters. We need some additional work on that and I used the PowerShell ISE object model here. There is a small workaround. Instead of RegEx, I just select the text from each token given by the parser.

This is it. After this, I used Out-GridView to be able to select the function I need to go to.

ISE Function Explorer

Now, we can just select the function we need to go to and click OK.

This post is to just show how powerful ISE object model is and to demonstrate that — in PowerShell — there is always more than one way to do the same thing.

 

Filed under: ISE Addons, PowerShell, Scripting

by

Ravikanth is a principal engineer and the lead architect for Microsoft and VMware virtualized and hybrid cloud solutions within the Infrastructure Solutions Group at Dell EMC. He is a multi-year recipient of Microsoft Most Valuable Professional (MVP) award in Windows PowerShell (CDM) and Microsoft Azure. Ravikanth is the author of Windows PowerShell Desired State Configuration Revealed (Apress) and leads Bangalore PowerShell and Bangalore IT Pro user groups. He can be seen speaking regularly at local user group events and conferences in India and abroad.