1
00:00:00,980 --> 00:00:03,860
Now, what about command types?

2
00:00:03,860 --> 00:00:08,720
So let's do Get‑Command, and let's look for all cmdlets on my system.

3
00:00:08,720 --> 00:00:12,410
And again, my list will look different than what you might have.

4
00:00:12,410 --> 00:00:17,280
Let's do the similar thing with functions.

5
00:00:17,280 --> 00:00:18,630
And again, those are all the functions.

6
00:00:18,630 --> 00:00:21,460
Now from a practical standpoint when you're working

7
00:00:21,460 --> 00:00:23,330
with these things in PowerShell,

8
00:00:23,330 --> 00:00:26,370
whether it's a command or a function really is irrelevant,

9
00:00:26,370 --> 00:00:30,570
they all are really going to behave the same.

10
00:00:30,570 --> 00:00:35,290
Aliases, something that we mentioned in the slides here.

11
00:00:35,290 --> 00:00:38,120
This is also technically a command type, so we can

12
00:00:38,120 --> 00:00:41,240
look and see all of the aliases.

13
00:00:41,240 --> 00:00:44,480
Now you'll see that some of them are pointing to blanks,

14
00:00:44,480 --> 00:00:49,280
that is because PowerShell knows about the alias, but the command that it is

15
00:00:49,280 --> 00:00:54,340
pointing to hasn't been loaded into my PowerShell session.

16
00:00:54,340 --> 00:00:55,640
Here's a little quiz for you.

17
00:00:55,640 --> 00:01:00,210
Can you think of a command that you might use to work with aliases?

18
00:01:00,210 --> 00:01:04,670
What could you do, what command could you possibly run that

19
00:01:04,670 --> 00:01:08,340
would get me all the aliases in my session?

20
00:01:08,340 --> 00:01:08,700
Well,

21
00:01:08,700 --> 00:01:11,480
we can do Get‑Command and then search for anything that

22
00:01:11,480 --> 00:01:14,520
has alias in the name, and sure enough,

23
00:01:14,520 --> 00:01:19,740
you can see that there is a Get‑Alias cmdlet.

24
00:01:19,740 --> 00:01:24,350
Or, we could have used the Get‑Command ‑noun and have alias in the

25
00:01:24,350 --> 00:01:27,660
noun, and that gives us, again, the same list.

26
00:01:27,660 --> 00:01:29,840
We see that Get‑Alias command, let's go ahead and

27
00:01:29,840 --> 00:01:32,600
give that a shot, and there we go.

28
00:01:32,600 --> 00:01:38,330
So these are all of the active aliases in my PowerShell session. And I know

29
00:01:38,330 --> 00:01:44,830
that one of them is ps, so that runs. Now, I know that ps is the alias for

30
00:01:44,830 --> 00:01:47,710
Get‑Process, so if I run the Get‑Process command,

31
00:01:47,710 --> 00:01:49,990
you can see I get the same results.

32
00:01:49,990 --> 00:01:55,130
Ps just is an easier thing to type, actually it's one that I use all the time.

33
00:01:55,130 --> 00:02:01,000
Even though I've got things like tab completion, ps just is muscle memory

34
00:02:01,000 --> 00:02:07,620
for me, so that's what I use. And so I can just do ps win*. So find me all

35
00:02:07,620 --> 00:02:13,040
the processes that have win as part of the name.

36
00:02:13,040 --> 00:02:15,840
Now here's something fun.

37
00:02:15,840 --> 00:02:16,940
Look at that.

38
00:02:16,940 --> 00:02:19,730
I happen to know, and now you know because you saw this

39
00:02:19,730 --> 00:02:23,310
here, that gcm is an alias for Get‑Command.

40
00:02:23,310 --> 00:02:29,870
So I did Get‑Command, Get‑Command, or I should say Get‑Command of gcm, and I

41
00:02:29,870 --> 00:02:33,240
see that that is an alias that resolves to Get‑Command.

42
00:02:33,240 --> 00:02:36,350
Now that I know that, I can save myself from typing and just

43
00:02:36,350 --> 00:02:39,370
do Get‑Command using the alias and say, hey,

44
00:02:39,370 --> 00:02:47,000
find me all the commands that have Computer in the noun, and I've got three of them in my PowerShell session.

