You are on page 1of 2

WINDOWS POWERSHELL INTEGRATED SCRIPTING ENVIRONMENT 4.

0
Created by http://powershellmagazine.com

KEYBOARD SHORTCUTS Script Pane Execution


Close an open script CTRL+F4 Run a script F5
General
Run only selection F8
Create new script CTRL+N Go to next script CTRL+TAB Run current caret line F8
Open a script CTRL+O Go to previous script CTRL+SHIFT+TAB Stop execution CTRL+BREAK
CTRL+C
New PowerShell tab CTRL+T NOTE: The shortcuts for switching between tabs are
Open a remote tab CTRL+SHIFT+R contextual. To switch between tabs using the above NOTE: Using CTRL+C for script execution termination works
Close an open tab Ctrl+W sequence, Script Pane must be in focus. only when no text selected in the Script or Console Pane.

Go to next PowerShell tab CTRL+TAB Start snippets CTRL+J


Go to previous PowerShell tab CTRL+SHIFT+TAB Toggle regions CTRL+M Debugging (Script Pane)
NOTE: To switch between tabs using the above Find in script CTRL+F Toggle breakpoint F9
sequence, Console Pane must be in focus. Find next in script F3 Run/Continue F5
Find previous in script SHIFT+F3 Step into F11
PowerShell ISE help F1 Replace in script CTRL+H Step over F10
Show Command CTRL+F1 Step out SHIFT+F11
Go to line CTRL+G Display call stack CTRL+SHIFT+D
NOTE: Remember that both commands require you Go to match CTRL+] List breakpoints CTRL+SHIFT+L
to select the command in the Script or Console pane, Remove all breakpoints CTRL+SHIFT+F9
or at least place the cursor near the command, NOTE: "Go to match" edit menu option will be Stop debugger SHIFT+F5
before invoking the key sequence. available only when the cursor is pointed at script block
beginning/end. In other words, it must be placed at the Debugging (Console Pane)
Zoom in CTRL+ADD opening or closing brace.
Zoom out CTRL+SUBTRACT Continue C
To upper case CTRL+SHIFT+U Step into S
Invoke command history #CTRL+SPACE To lower case CTRL+U Step over V
Cycle through history #TAB Transpose lines ALT+SHIFT+T Step out O
Start IntelliSense CTRL+SPACE Repeat last command Enter
Start PowerShell.exe CTRL+SHIFT+P Go to Console Pane CTRL+D Display call stack K
Show / Hide Script Pane CTRL+R Stop debugger Q
List the script L
Show Script Pane top CTRL+1 Display console debug commands H or ?
Show Script Pane right CTRL+2
Show Script Pane maximized CTRL+3
PowerShell_ISE.exe PARAMETERS
Console Pane
NOTE: Only a subset of above Script Pane keyboard
Go to Script Pane CTRL+I shortcuts are available, depending on the current PowerShell_ISE.exe
Cycle through command history UP ARROW Script Pane state. -File "file1.ps1, file2.ps1" [Opens file1 & file2]
DOWN ARROW -NoProfile [Does not run profile script]
Scroll to the output CTRL+UP ARROW -MTA [Starts ISE in MTA mode]
WINDOWS POWERSHELL INTEGRATED SCRIPTING ENVIRONMENT 4.0
Created by http://powershellmagazine.com

ISE SNIPPETS $psISE.Options $psISE.CurrentPowerShellTab


Defines the ISE color scheme and appearance-related Defines the properties of the current PowerShell tab and a
Snippets are an easy way to insert chunks of re- options. For example, use these options to set how ISE collection of files in the tab. Also, defines the method to
usable or template code into a script. The snippet color scheme looks, how the ISE panes appear, font size, extend ISE add-on menu.
functions are available only in ISE. font name, and IntelliSense options.
Create a new Snippet $psISE.CurrentPowerShellTab.Files defines a collection of
$textcode = 'workflow MyWorkflow{ The color scheme and appearance options are best open files in the tab that can be managed the same way as
adjusted by using commands on the Tools -> Options menu $psISE.CurrentFile.
}' item in ISE. Here is the other important information:
New-IseSnippet -Title "Workflow" -Text $textcode ` $psISE.CurrentPowerShellTab.AddonsMenu contains a
-Description "New workflow block" To change "most recently used" count, set collection of existing add-on menus and method to create
$psISE.Options.MruCount to desired value between 0,32. new.
Get ISE Snippets
Get-IseSnippet To disable local help, set $psISE.Options.UseLocalHelp to To add a new add-on menu
$false. $script = { $psISE.CurrentFile.Editor.SelectCaretLine() }
ISE OBJECT MODEL $psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Ad
$psISE.Options.RestoreDefaults() restores all options to d("Select _Line",$script,"Alt+L")
ISE exposes its underlying scripting object model to ISE defaults.
allow manipulation of various visual and functional To remove an add-on menu at index 0
aspects of ISE. $psISE is the root object of the ISE $psISE.CurrentFile $addon = $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus
object hierarchy. $addon.Remove($addon[0])
Defines the properties of the current open file in ISE Script
Pane such as displayname, fullpath, encoding, etc. $psISE.PowerShellTabs
$psISE
$psISE.CurrentFile.Editor contains the information about Defines a collection of open PowerShell tabs in ISE. Each
$psISE.Options the script editor and the contents of the editor. instance of PowerShell tab contains the same properties
and methods as $psISE.CurrentPowerShellTab.
$psISE.CurrentFile $psISE.CurrentFile.Editor.InsertText("sample") inserts
specified text at the current caret position. $psISE.PowerShellTabs.Files lists all open files in ISE
across all open PowerShell tabs.
$psISE.PowerShellTabs
$psISE.CurrentFile.Editor.Clear() clears the text in the
editor. $psISE.PowerShellTabs.AddonsMenu lists all add-on
$psISE.CurrentPowerShellTab menus available across all open PowerShell tabs.
$psISE.CurrentFile.Editor.SelectCaretLine() selects the line
$psISE. CurrentVisibleHorizontalTool where cursor is placed. $psISE events

The $psISE scripting object model provides events when a property or collection changes within ISE. These events are
$psISE. CurrentVisibleVerticalTool
usually named as PropertyChanged or CollectionChanged based on the object.
The $psISE.CurrentVisibleHorizontalTool and
$psISE.CurrentVisibleVerticalTool objects are For example, the following code adds an add-on menu to all newly opened PowerShell tabs:
available only when an add-on--for example, the Register-ObjectEvent -InputObject $psise.PowerShellTabs -EventName CollectionChanged -Action {
ShowCommands add-on--is visible in ISE. if ($event.SourceEventArgs.Action -eq "Add") {
$event.Sender[1].AddOnsMenu.SubMenus.Add("Select _Line",{$psISE.CurrentFile.Editor.SelectCaretLine()},"Alt+L") } }

You might also like