Learn about Windows PowerShell
Summary: Microsoft Scripting Guy, Ed Wilson, talks about Windows PowerShell best practices for the console.
Microsoft Scripting Guy, Ed Wilson, is here. This morning, the Scripting Wife and I decided to head to a new breakfast place that had great reviews on Yelp. We grabbed our Surface 2s and headed into town. Teresa had her new Surface 2 RT with 4G, and I took my new Surface 2 Pro with the power keyboard.
One of the things that got my attention about this restaurant was the statement that they made their scones in house from fresh ingredients instead of from mixes. They also claimed to have 30 different types of tea, so I was in.
Well, they did have scones, but most were covered with ½ inch thick sugar icing. I did find a multiberry one that was not. Most of the teas were fruit or herb, which I am sure you know is not even a real tea. But I did settle on a nice cup of English Breakfast tea. They had a good Internet connection, so our breakfast was worthwhile.
Speaking of worthwhile…
I spend most of my day with the Windows PowerShell console. In fact, I generally have two Windows PowerShell consoles open at the same time. I have one in which I am working, and a second one where I am looking up Help content. If I need elevated permissions, I open a third Windows PowerShell console.
The key thing to remember is the purpose of the operation. For example, when I am working interactively at the Windows PowerShell console, I am focusing on commands and quickly getting work done. Here are some of the things that I do:
That is a quick overview of best practices for working with the Windows PowerShell console. Best Practices Week will continue tomorrow when I will talk about best practices for Windows PowerShell scripts. What are some of the things that you do to make life easier when you are working in the Windows PowerShell console?
I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at firstname.lastname@example.org, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.
Ed Wilson, Microsoft Scripting Guy
Dont forget: Use filter instead of where so you dont load more than necessary.
PSConsole which is mentioned at the end is great. But for those who familiar with Far Manager I would also recommend to take a look at FarNet.PowerShellFar (see NuGet) which implements the console based ISE in Far Manager. Here is the very short list of
https://github.com/nightroman/FarNet-Wiki/wiki/PowerShellFar-features (starred by Scott Hanselman, if this matters). Unlike various GUI ISE's, this ISE does not have difficulties with invoking native applications, even with interaction, because the host
is implemented for a genuine console environment (thanks to Far Manager features and API exposed via FarNet).
Is there a reason to use the Console over the ISE? I see this often but never understood why, is it Start-Transcript?
@Anon, command-line (console) apps may not work in ISE as they do in console.