Understanding streams in PowerShell
In the past, we have spoken about how cmdlets output objects, and how output can be piped from one cmdlet to another. If you ever encountered errors or warnings or verbose output in the execution that involved outputting content to a file, these errors, warnings, verbose outputs… none of them is passed through the pipe into, say, the export cmdlet. Ever wondered why? Enter: Streams Output redirection Out-Host Read-Host The Information stream Redirecting output across streams Wrapping up I speak about the nature of output in PowerShell, in my book:
Piping Commands in PowerShell
We used the pipeline in our past posts. However, we did look into what they are and what they do. If you have had experience with Linux (or Bash in general), there is a good chance you know that the pipeline simply passes the output of a certain command to the command to its right. In this article, we discuss all about pipelines: Understanding the pipeline Using the pipeline to select properties Filtering the output based on a parameter How PowerShell outputs content Formatting the output Only in the end Wrapping up Understanding the pipeline Metaphorically speaking, think of a cmdlet as a machine.
Basics of Cmdlets
Cmdlets are at the core of PowerShell. As already noted in The object-oriented model, a cmdlet is a specialised .NET object, with output formatting that makes sense to an administrator. In this article, we discuss the following: Getting help information for a cmdlet Parameter sets Positional parameters Help on specific parameters Assigning values to a parameter Getting help information for a cmdlet Let us pick a common cmdlet: Get-ChildItem, a simple, useful cmdlet.
The object-oriented model
The moment someone mentions PowerShell or talks about its benefits, one of the first things that comes to people’s minds is how the output is an object. And most of us don’t understand why this should be a big deal that it is made out to be. Or what it even means. I’ve been there, and it took me some time to fully understand its importance. In this article, we talk about:
Aliases, execution policies and other friendly features
Everything comes with a learning curve. A slew of new commands, syntaxes, semantics and what not. The transition, usually, is not easy. I was taught C++ in school. However, we had to learn C during my Bachelor’s. It was tough, at first. I mixed up syntaxes. A lot. In this post, we talk about: Aliases in PowerShell Execution Policies in PowerShell ShouldProcess and ShouldContinue Aliases in PowerShell Making the transition from CMD difficult would be counter-intuitive, especially when Microsoft wants to encourage the use of PowerShell.