1
00:00:00,940 --> 00:00:02,910
Up until now, we've been working with

2
00:00:02,910 --> 00:00:05,420
pre‑installed modules, and you understand

3
00:00:05,420 --> 00:00:07,530
where they're located on your machine and

4
00:00:07,530 --> 00:00:09,750
how to import them. But you'll also need

5
00:00:09,750 --> 00:00:11,830
to know how to find which commands are

6
00:00:11,830 --> 00:00:15,050
included inside of a module because, well,

7
00:00:15,050 --> 00:00:16,590
the commands are what you'll be running

8
00:00:16,590 --> 00:00:19,440
with to actually do tasks with PowerShell.

9
00:00:19,440 --> 00:00:21,850
Let's dig into that. There's a handy

10
00:00:21,850 --> 00:00:24,440
command to know about called Get‑Command.

11
00:00:24,440 --> 00:00:26,140
If we run that with no parameters or

12
00:00:26,140 --> 00:00:28,940
settings, it will go and list all of the

13
00:00:28,940 --> 00:00:31,420
commands that exists in all of the modules

14
00:00:31,420 --> 00:00:34,700
on this machine. Wow, that's a big list

15
00:00:34,700 --> 00:00:37,230
and really not too helpful. There's a

16
00:00:37,230 --> 00:00:39,120
parameter on Get‑Command named

17
00:00:39,120 --> 00:00:42,450
ListImported. And if I run that, we'll get

18
00:00:42,450 --> 00:00:44,470
a list of commands included only in

19
00:00:44,470 --> 00:00:46,400
modules that have been imported into this

20
00:00:46,400 --> 00:00:49,330
session. That's a much smaller list, but

21
00:00:49,330 --> 00:00:51,140
it's still got a lot of information to go

22
00:00:51,140 --> 00:00:53,980
through to find commands. Another option

23
00:00:53,980 --> 00:00:56,090
with Get‑Command is to use the module

24
00:00:56,090 --> 00:00:58,500
parameter to specify which PowerShell

25
00:00:58,500 --> 00:01:01,240
module you want to list the commands for.

26
00:01:01,240 --> 00:01:03,090
Let's try that out with Get‑Command

27
00:01:03,090 --> 00:01:06,820
‑ModuleBitsTransfer. Ah, that's a bit more

28
00:01:06,820 --> 00:01:09,050
digestible as we've been provided a list

29
00:01:09,050 --> 00:01:11,270
of commands that are specific just to this

30
00:01:11,270 --> 00:01:13,530
module so you can quickly see the type of

31
00:01:13,530 --> 00:01:16,250
actions you can perform by leveraging this

32
00:01:16,250 --> 00:01:18,930
module. Another way to see the commands

33
00:01:18,930 --> 00:01:21,150
inside of a module, and you've seen this

34
00:01:21,150 --> 00:01:23,700
before if you were watching closely, is to

35
00:01:23,700 --> 00:01:26,120
run Get‑Module and the name of the module,

36
00:01:26,120 --> 00:01:29,680
so BitsTransfer. And this ExportedCommands

37
00:01:29,680 --> 00:01:32,050
property lists the commands included in

38
00:01:32,050 --> 00:01:34,470
the module. That's not really the best

39
00:01:34,470 --> 00:01:36,920
view there, so what you can do is enclose

40
00:01:36,920 --> 00:01:39,460
to Get‑Module command in parentheses

41
00:01:39,460 --> 00:01:41,770
followed by a period, and we can look at

42
00:01:41,770 --> 00:01:44,320
that ExportedCommands property. And that's

43
00:01:44,320 --> 00:01:46,220
a bit nicer listed out that way as we can

44
00:01:46,220 --> 00:01:48,980
see all the values. Note that this is the

45
00:01:48,980 --> 00:01:50,510
same list as before when we did

46
00:01:50,510 --> 00:01:52,590
Get‑Command. So there's a few different

47
00:01:52,590 --> 00:01:54,790
ways to find all of the commands inside of

48
00:01:54,790 --> 00:01:57,300
a module. Remembering the PowerShell

49
00:01:57,300 --> 00:02:00,140
language standard of using verb‑noun for

50
00:02:00,140 --> 00:02:03,040
command naming, another option we have is

51
00:02:03,040 --> 00:02:04,780
to search only for commands with a

52
00:02:04,780 --> 00:02:07,750
particular verb. Let's say, for example,

53
00:02:07,750 --> 00:02:09,870
that I know I need to do something with

54
00:02:09,870 --> 00:02:12,190
the bits transfer service, but all I want

55
00:02:12,190 --> 00:02:14,940
to do is get some information. If I run

56
00:02:14,940 --> 00:02:18,080
Get‑Command ‑Module BitsTransfer and then

57
00:02:18,080 --> 00:02:21,200
use a verb parameter, and I'll specify get

58
00:02:21,200 --> 00:02:23,640
as the verb, this will only return

59
00:02:23,640 --> 00:02:25,970
commands from the module that have a verb

60
00:02:25,970 --> 00:02:28,180
get, and there happens to be only one

61
00:02:28,180 --> 00:02:30,740
command returned. This is a really nice

62
00:02:30,740 --> 00:02:33,160
way to further filter down on commands

63
00:02:33,160 --> 00:02:34,970
when you know what type of action you want

64
00:02:34,970 --> 00:02:37,160
to take, but aren't sure exactly what the

65
00:02:37,160 --> 00:02:38,800
command might be named, which is

66
00:02:38,800 --> 00:02:40,910
particularly helpful in modules containing

67
00:02:40,910 --> 00:02:44,080
lots of commands. Finally, you can also

68
00:02:44,080 --> 00:02:45,810
perform wildcard searches with

69
00:02:45,810 --> 00:02:48,090
Get‑Command. So let's assume I wanted to

70
00:02:48,090 --> 00:02:49,940
do something with a file related to

71
00:02:49,940 --> 00:02:51,900
BitsTransfer, but I didn't yet know what

72
00:02:51,900 --> 00:02:54,680
that was. If I just press the up arrow to

73
00:02:54,680 --> 00:02:56,840
get that command again, but at the end

74
00:02:56,840 --> 00:02:59,310
instead of specifying the verb, I'll just

75
00:02:59,310 --> 00:03:02,580
put *file*, which will perform a wildcard

76
00:03:02,580 --> 00:03:05,090
search for any command with file in the

77
00:03:05,090 --> 00:03:07,750
name. And again, we happen to only have

78
00:03:07,750 --> 00:03:10,400
one result. But now I know really quickly

79
00:03:10,400 --> 00:03:12,090
that there's only one command in this

80
00:03:12,090 --> 00:03:17,000
module that might be related to the task I'm trying to perform.

