Skip to content

Instantly share code, notes, and snippets.

@mattmcnabb
Last active August 23, 2016 02:00
Show Gist options
  • Save mattmcnabb/fa25dedb8ed23a3b8b79c0c23c480fde to your computer and use it in GitHub Desktop.
Save mattmcnabb/fa25dedb8ed23a3b8b79c0c23c480fde to your computer and use it in GitHub Desktop.
Blog_ISESteroids-make-it-yours
$SB = {
$Command = Get-Command -Name $args[1]
Get-Module -Name $Command.ModuleName |
Format-List Name, Description, Version, PowerShellHostName,
PowerShellVersion, Author, CompanyName
}
Add-SteroidsContextMenuCommand -DisplayName 'Get Parent Module' -TokenType Command -ScriptBlock $SB
Add-SteroidsTool -DisplayName 'WMI Tester' -Path wbemtest.exe -ToolTip 'Explore WMI classes and compose queries'
# this line will add a new custom command with the keyboard shortcut ALT+T:
$psise.CurrentPowerShellTab.AddOnsMenu.Submenus.Add('Start Regedit', { regedit.exe }, 'ALT+T')
# this line will add a new custom command without a keyboard shortcut:
$psise.CurrentPowerShellTab.AddOnsMenu.Submenus.Add('Get Script Path', { $psise.CurrentFile.FullPath }, $null)
# these lines will first add a submenu, then add commands to it:
$parent = $psise.CurrentPowerShellTab.AddOnsMenu.SubMenus.Add('My Tools', $null, $null)
$parent.Submenus.Add('Close All Editors', { $psise.CurrentPowerShellTab.Files.Clear() }, 'ALT+X' )
$parent.Submenus.Add('Open powertheshell.com', { Start-Process www.powertheshell.com }, 'ALT+P' )
# all commands will be defined once you run this script
# to define commands permanently, place this code into your profile script
# the path to the profile script can be found in $profile. You may have to create the file and subfolder first.
$null = $psise.CurrentPowerShellTab.AddOnsMenu.Submenus.Add('Remove Trailing Blanks', {Remove-TrailingBlanks},$null)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment