If you use PowerShell on a regular or semi-regular basis you may already know these tricks of the trade, but in case you were not aware here are some neat tricks to use in the PowerShell console window.
Go ahead and type a partial command and press your Tab key. PowerShell magically knows what you’re trying to look for, or at least it will venture an educated guess.
Get-Da should autocomplete to Get-Date.
You can even press Tab (and Shift-Tab) multiple times to cycle through multiple matches.
Get- should autocomplete to multiple commands. Just keep pressing Tab to cycle forwards alphabetically and press Shift-Tab to cycle backward alphabetically.
This is great for typing commands more quickly or for trying to type commands that you may not fully remember.
You can show all recently typed commands at a console window by tapping the F7 key. You can then select a command by highlighting it and hitting the Enter key.
You type a command and realize you have a syntax error. Rather than type the command all over again, you can simply tap the Up arrow key to scroll backwards through your recent commands. You can tap the Down arrow key to scroll forwards.
Have you ever run a command that output more results than fit the screen? Usually, the results will zoom past faster than most of us can read, so we often find ourselves having to scroll to view the results.
There are two common methods for accomplishing this:
| Out-Host -Paging
Something to note, however, is that it will evaluate the results of a command before outputting them to the console window.
I know that there are many other tips that each of us have come across (aliases, for example). Please feel free to add any suggestions to the comments below so that other readers may be able to benefit from your experience!
Did you know that PDQ Deploy has a PowerShell step you can use to deploy your scripts?