Hey everyone,
and welcome back to the next step in learning how to put PowerShell to work.
In this part of the course,
we're going to dive a bit deeper into working with
objects in the PowerShell pipeline.
As you'll see, once you understand core PowerShell concepts,
you can apply them to anything.
It doesn't matter if it's a process or an Azure Virtual Machine.
In most situations, especially when running PowerShell interactively,
you want to let the PowerShell pipeline do a lot of the heavy lifting.
Don't think about working with one thing at a time.
Work with all of them at once.
In this module,
I want to go through some core PowerShell commands that
you'll most likely use all the time.
These are commands that treat all objects equally.
In other words,
a file object is no different than an Active
Directory user or a virtual machine.
Say you need to sort something.
There aren't different sorting commands for files
and users. It's the same command, Sort‑ Object.
The command does exactly what that name implies.
It doesn't care what the object represents. Give it a property name to sort on,
and you're good to go.
The same is true of grouping.
This is a very useful command and one that I use very often.
Grouping is the process of organizing objects into groups or
buckets based on some common property.
Again, the grouping process is the same whether it's a file,
process, or virtual machine.
Another common task, and one you'll be doing often,
is selecting objects or parts of objects.
By this I mean, maybe you're running a command to get a bunch of something,
like Exchange mailboxes, but you really only need the first five items.
Select‑Object is what makes this possible.
This command has other features which will help you
fine tune your PowerShell expression, and I'll get to those shortly.
And lastly, PowerShell has a measurement command.
Often an object will have some property with a numeric value,
like the length or size of a file.
Measure‑Object offers several simple mathematical
measurements based on that value.
To reiterate, we have one command to measure any type of object.
And by the way, all of these commands have aliases,
which is just the verb part of the name,
like group, sort, and measure.
You'll use these commands often and most likely together. We'll see some of that when I get to the demonstration.