Now, what about command types?
So let's do Get‑Command, and let's look for all cmdlets on my system.
And again, my list will look different than what you might have.
Let's do the similar thing with functions.
And again, those are all the functions.
Now from a practical standpoint when you're working
with these things in PowerShell,
whether it's a command or a function really is irrelevant,
they all are really going to behave the same.
Aliases, something that we mentioned in the slides here.
This is also technically a command type, so we can
look and see all of the aliases.
Now you'll see that some of them are pointing to blanks,
that is because PowerShell knows about the alias, but the command that it is
pointing to hasn't been loaded into my PowerShell session.
Here's a little quiz for you.
Can you think of a command that you might use to work with aliases?
What could you do, what command could you possibly run that
would get me all the aliases in my session?
Well,
we can do Get‑Command and then search for anything that
has alias in the name, and sure enough,
you can see that there is a Get‑Alias cmdlet.
Or, we could have used the Get‑Command ‑noun and have alias in the
noun, and that gives us, again, the same list.
We see that Get‑Alias command, let's go ahead and
give that a shot, and there we go.
So these are all of the active aliases in my PowerShell session. And I know
that one of them is ps, so that runs. Now, I know that ps is the alias for
Get‑Process, so if I run the Get‑Process command,
you can see I get the same results.
Ps just is an easier thing to type, actually it's one that I use all the time.
Even though I've got things like tab completion, ps just is muscle memory
for me, so that's what I use. And so I can just do ps win*. So find me all
the processes that have win as part of the name.
Now here's something fun.
Look at that.
I happen to know, and now you know because you saw this
here, that gcm is an alias for Get‑Command.
So I did Get‑Command, Get‑Command, or I should say Get‑Command of gcm, and I
see that that is an alias that resolves to Get‑Command.
Now that I know that, I can save myself from typing and just
do Get‑Command using the alias and say, hey,
find me all the commands that have Computer in the noun, and I've got three of them in my PowerShell session.