The ISESnippetObject
An ISESnippet object is an instance of the Microsoft.PowerShell.Host.ISE.ISESnippet class. The
members of the $psISE.CurrentPowerShellTab.Snippets
collection are all examples of ISESnippet
objects. The easiest way to create a snippet is to use the
New-IseSnippet cmdlet.
Properties
Author
Supported in Windows PowerShell ISE 3.0 and later, and not present in earlier versions.
The read-only property that gets the name of the author of the snippet.
# Get the author of the first snippet item
$psISE.CurrentPowerShellTab.Snippets.Item(0).Author
CodeFragment
Supported in Windows PowerShell ISE 3.0 and later, and not present in earlier versions.
The read-only property that gets the code fragment to be inserted into the editor.
# Get the code fragment associated with the first snippet item.
$psISE.CurrentPowerShellTab.Snippets.Item(0).CodeFragment
Shortcut
Supported in Windows PowerShell ISE 3.0 and later, and not present in earlier versions.
The read-only property that gets the Windows keyboard shortcut for the menu item.
# Get the shortcut for the first submenu item.
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Clear()
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add('_Process', {Get-Process}, 'Alt+P')
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus[0].Shortcut
See Also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for