Creating Code Snippets for ISE

by Dec 17, 2015

PowerShell ISE supports code snippets, and you can easily create your own:

#requires -Version 3

$code = @' 
| Where-Object { $_ }
'@


New-IseSnippet -Title Where-Object -Description 'adds Where-Object' -Text $code -Force

This adds a new code snippet called "Where-Object". To insert it, type "where" and press CTRL+J, then select your snippet. Note that snippets persist, so there is no need for you to run this code in your profile.

Use the -Force parameter to overwrite and update existing snippets.

Twitter This Tip! ReTweet this Tip!