1
00:00:01,540 --> 00:00:03,220
So let's go back into PowerShell,

2
00:00:03,220 --> 00:00:06,140
and let's look at a few more examples to reinforce the

3
00:00:06,140 --> 00:00:09,400
information that I've given you here in these slides.

4
00:00:09,400 --> 00:00:13,300
Alright, so let's begin, and let's just run help again for Get‑Service,

5
00:00:13,300 --> 00:00:17,480
just make sure this also works here.

6
00:00:17,480 --> 00:00:21,440
Alright, so it's same information that we saw before.

7
00:00:21,440 --> 00:00:24,480
And again, I can do help Get‑Service.

8
00:00:24,480 --> 00:00:28,340
If I want to look at the parameter name,

9
00:00:28,340 --> 00:00:30,500
I can see some details about that parameter.

10
00:00:30,500 --> 00:00:32,810
We covered this little bit in the slides.

11
00:00:32,810 --> 00:00:39,000
But knowing that, I should be able to run a command like Get‑Service,

12
00:00:39,000 --> 00:00:40,040
and I see everything.

13
00:00:40,040 --> 00:00:42,990
I didn't specify ‑Name or any other of the parameters

14
00:00:42,990 --> 00:00:45,740
because I didn't really need to.

15
00:00:45,740 --> 00:00:46,520
We're going to come back,

16
00:00:46,520 --> 00:00:48,950
and we're going to look at the name parameter in a little more

17
00:00:48,950 --> 00:00:51,240
detail because that is kind of the default,

18
00:00:51,240 --> 00:00:55,460
but this command is designed to really not need anything.

19
00:00:55,460 --> 00:00:59,640
It assumes if I run Get‑Service without specifying anything,

20
00:00:59,640 --> 00:01:02,930
it's going to give me all of the services.

21
00:01:02,930 --> 00:01:07,300
However, if I wanted to, I could do this.

22
00:01:07,300 --> 00:01:11,100
I could say find me all the services where the name is bits, winrm, or winmgmt.

23
00:01:11,100 --> 00:01:17,940
Now I'm using the ‑Name parameter, and I get just those services.

24
00:01:17,940 --> 00:01:20,040
How about this?

25
00:01:20,040 --> 00:01:25,720
Let's do Get‑Service bits, winrm, winmgmt.

26
00:01:25,720 --> 00:01:27,030
That also works.

27
00:01:27,030 --> 00:01:31,370
Now the difference is I did not use the ‑Name parameter.

28
00:01:31,370 --> 00:01:37,060
That's because ‑Name is positional.

29
00:01:37,060 --> 00:01:39,300
Let's look at another example here.

30
00:01:39,300 --> 00:01:43,590
Let's do bits, and then win*, and we're going too

31
00:01:43,590 --> 00:01:48,400
pipe those strings to Get‑Service.

32
00:01:48,400 --> 00:01:49,570
Hey, look at that.

33
00:01:49,570 --> 00:01:52,980
So there's bits, and then because there's a wildcard,

34
00:01:52,980 --> 00:01:57,340
I get all of the services that start with win.

35
00:01:57,340 --> 00:01:59,460
If I want to review why that is,

36
00:01:59,460 --> 00:02:02,170
I could look at help for Get‑Service, so look at that Name

37
00:02:02,170 --> 00:02:07,360
parameter. Now we can see there a couple things. Again, reminder,

38
00:02:07,360 --> 00:02:12,070
this takes strings, and see the double square brackets, that means

39
00:02:12,070 --> 00:02:14,510
it can take multiple strings, which, as you saw,

40
00:02:14,510 --> 00:02:16,940
that's what I did in my demo.

41
00:02:16,940 --> 00:02:18,890
It's not required,

42
00:02:18,890 --> 00:02:22,210
and we saw that because I can just run Get‑Service, and it works.

43
00:02:22,210 --> 00:02:26,760
I don't have to type the name of the parameter, ‑Name, because it

44
00:02:26,760 --> 00:02:30,340
is positional, and you see it has position 0.

45
00:02:30,340 --> 00:02:32,200
There is no default value.

46
00:02:32,200 --> 00:02:38,450
It will accept pipeline input by proper name and by value. Value means, hey,

47
00:02:38,450 --> 00:02:44,030
whenever I see like strings, I'm going to assign them to the parameter

48
00:02:44,030 --> 00:02:49,350
‑Name. ByPropertyName, I'll just give you a little heads up, you'll learn

49
00:02:49,350 --> 00:02:54,330
more about this later, ByPropertyName means if I see an object coming in

50
00:02:54,330 --> 00:02:58,720
that has a parameter, I'm sorry, if I see an object coming in that has a

51
00:02:58,720 --> 00:03:03,170
property name that matches the parameter name, then I'm going to hook

52
00:03:03,170 --> 00:03:07,660
those two values together and magic happens, which is a really a wonderful

53
00:03:07,660 --> 00:03:07,920
thing.

54
00:03:07,920 --> 00:03:11,480
I have another demo coming up where you'll see how that works.

55
00:03:11,480 --> 00:03:16,010
And you can also see here from the help that it accepts wildcard characters,

56
00:03:16,010 --> 00:03:22,240
and I proved that by using win*. You can run the command, and help will help

57
00:03:22,240 --> 00:03:31,000
you decide how to run it, or at least reinforce or make sure you understand why it's working the way that it does.

