PowerShell ISE Snippets
In past articles, I’ve written about using snippets in VS Code, although I might revisit this in-depth in a future article. As much as I like VS Code and recommend it, I know that the PowerShell ISE is still the primary editor for many people. Even though Microsoft is no longer developing the ISE, it is still a viable editor. I even open it occasionally when VS Code gets in the way.
One of the ISE’s features that often goes overlooked is its snippets. You can insert frequently used code fragments directly into your script file with a few simple keystrokes. In the PowerShell ISE script, press Ctrl+J to invoke the snippet list.
Scroll down to find the snippet you want, or begin typing the name. As each snippet is highlighted, you’ll see the code in the pop-out. Find the snippet you want, press Enter, and the code is inserted at the cursor. Snippets can make your scripting much more enjoyable since it removes much of the grunt work.