All posts filed under: ISE Addons

PowerShell ISE Addon: Validate and Format XML

I have been playing with XML documents a lot these days and at times I find myself dealing with a few pages long XML data. The most frustrating part is the un-formatted and invalid XML. May times, I find myself dealing with XML errors than any script errors. So, here is another addon to make life easy when using XML documents in PowerShell ISE. This addon actually comes with a couple of functions.

PowerShell ISE Addon: Reset all ISE preferences

Ever since PowerShell v3.0 CTP build got released, I am using ISE as my primary script editor. I keep changing preferences such as colors, etc. The new feature in ISE v3 remembers the changes made to ISE options. While this is quite useful, sometimes resetting all the changes we did can become painful. I need to use Tool->Options dialog and then click the ‘Restore Defaults’ button Or we can use the $psise.Options.RestoreDefaults() method. I am not sure of any other method unless I missed it in the RTFM

PowerShell ISE Addon: Go to cursor

I have a few scripts that are thousands of lines long. When working with these scripts in ISE, I often start modifying some part of the code and then use scroll bar to move up and down to refer to other parts of the code. In this process, I naturally lose track of the cursor position. This happens quite often and started frustrating me. So, I wrote a simple addon that takes me back to where the cursor is and re-focuses editor window at the cursor position by scrolling back to that place

A simple PowerShell script explorer addon using ShowUI

Update: The select-ViaUI function is no more in ShowUI module starting version 1.2. So, if you plan to run this, you need to go back to ShowUI 1.1. Okay, there is nothing really fancy here. This is all done in just ten lines of PowerShell code. In fact, only 3 lines for the real logic. I am not even creating my own UI to do this. This is all done using the Select-ViaUI cmdlet in ShowUI module. Here is how it looks: So, within this addon, I list all ps1, psm1, and xml files at a pre-defined location. At the bottom, you see a search box. If you find it difficult to scroll to the item you want, you can just type the name ( or partial name) and filter the list. Once you select the item, just click OK to open that file(s) in ISE. Simple! Here is the code:

Just execute the above code or add the above code to your ISE profile and restart ISE. Now, when you press Ctrl+Alt+E, this …