Removing Code Snippets in PowerShell ISE v3

by Aug 15, 2012

In a previous tip we showed you how to add your own little code snippets to the new PowerShell ISE v3 script editor. Here's how you can get rid of code snippets:

Get-ISESnippet returns all snippets that you registered previously with New-ISESnippet. Actually, the snippets returned are XML files. You can pipe them to Remove-Item to remove them. This would remove ALL custom snippets

Get-ISESnippet | Remove-Item

If you want to just delete a particular snippet, you could use an approach like this:

PS> dir (Join-Path (Split-Path $profile) 'Snippets') Tr*

    Directory: C:\Users\Tobias\Documents\WindowsPowerShell\Snippets


Mode                LastWriteTime     Length Name                                                                                      
----                -------------     ------ ----                                                                                      
-a---        02.07.2012     00:04        966 Trap.snippets.ps1xml

This would list only snippets that start with "Tr". Pipe the results to Remove-Item to delete these snippets.

http://bit.ly/QZzO5J

Twitter This Tip! ReTweet this Tip!