There were quite a few sessions on PowerShell this year at TechEd North America. Experts like Don Jones and Jeffrey Snover showed the audience some great tricks that I would like to share with you...As well as some of my own findings. Some of you are probably already experts using the shell but it is always useful to find some tips that ease the “PowerShell experience”, especially when you're writing scripts.
So, I would like to talk to you about PowerShell ISE!
The Integrated Scripting Environment (ISE) is a full GUI interface for editing and executing PowerShell scripts. Most of us will probably find this easier compared to the raw shell. ;)
The basic layout of the PowerShell ISE has three main frames: one for editing scripts, one actual shell window, and a toolbox of cmdlets.
In this shell, you will finally be able to copy/paste using Ctrl + C / Ctrl + V. You'll also be able to use autocompletion with cmdlets and name parameters, thanks to IntelliSense:
Here's a good tip: you can select any lines you want and press “F8” to execute them.
Using the “Commands” panel, you can search for cmdlets:
You can open different Runspaces using the Ctrl + T shortcut, and even create a “Remote PowerShell Tab” using Ctrl + Shift + R. This will prompt you for parameters and credentials.
Then, you will open a remote shell:
Another nice trick you can use either in the ISE or usual shell is the “Out-GridView” command. You will be able to pipe out most of the cmdlets and it will display the results in a convenient grid view that can be filtered:
Get-Service | Out-GridView
If you would rather copy/paste the results, you can change the output to “clip” to put the results on your clipboard:
Get-Service | clip
If you need to enhance the ISE experience, you can find some add-ons online by clicking:
Finally, do not forget to update the help files in PowerShell every once in a while. Simply use « update-help » in the shell. Be careful here, you might have to start PowerShell as an administrator in order for the update to be successful.
I hope you learned some new tricks to help improve your daily PowerShell activities. Don't hesitate to give us your own tips in the comments below, I will be happy to try them!