One of the most important concepts for people to learn and
embrace is what I call the PowerShell paradigm.
As I said a moment ago, when you run a command in PowerShell,
you don't have to parse or manipulate any text output.
Instead,
you work with objects. Now don't worry, you don't have to be a developer.
Eventually you'll realize that this is not that difficult.
The objects move through a pipeline.
Each command in your PowerShell expression can do something.
At the end of the pipeline, PowerShell displays your results.
And when it comes a scripting, if you can type it at a prompt,
you can build a script around it.
There's essentially no difference between the commands you type
interactively and what you put into a script file.
The script gives you some flexibility and saves a whole lot of typing.
Here's a taste of what IT pros used to have to deal with when
using VBScript, for example. This is about 20 lines of script
that is not easy to learn or to write. The script has to
essentially parse the results as text.
Now all of this script has been saved to a file and
then executed at a command line.
The result is some text that shows disk usage. Very useful,
but it was a lot of work to get to that result. Now compare all of
that to this one‑line PowerShell command. Even though it looks like a
long line, technically this is one command.
There's no scripting needed, you can type it at a prompt.
And while it may look daunting, especially if you are totally new to PowerShell,
once you learn more about PowerShell's language and syntax,
you'll realize that it is actually pretty easy to understand and write. Now,
if this was something that you wanted to do often, you can create a
PowerShell script and save yourself from typing, or running it at a
prompt interactively to get the same results.
An advantage that I'm not showing is that if I needed to export the
results to say a CSV file or convert it into JSON,
I can add on more PowerShell commands.
You should think of PowerShell as a management engine.
This engine can be exposed interactively or through
scripting. PowerShell is more, much, much more, than just a shell or successor to VBScript.