1
00:00:01,140 --> 00:00:06,940
As a quick review, there are two primary ways to find PowerShell commands.

2
00:00:06,940 --> 00:00:09,210
You can use the Get‑Command cmdlet.

3
00:00:09,210 --> 00:00:14,340
Remember, a cmdlet is just the fancy name for a compiled PowerShell command.

4
00:00:14,340 --> 00:00:17,920
I'll probably use cmdlet and command interchangeably,

5
00:00:17,920 --> 00:00:20,140
but they really mean the same thing.

6
00:00:20,140 --> 00:00:22,170
You can also use the Get‑Help command,

7
00:00:22,170 --> 00:00:25,740
which has the added benefit of showing you how to run the command.

8
00:00:25,740 --> 00:00:28,740
I'll get into these a bit later in the demos.

9
00:00:28,740 --> 00:00:32,540
PowerShell has a few command types or categories.

10
00:00:32,540 --> 00:00:36,270
The primary unit of execution is called a cmdlet.

11
00:00:36,270 --> 00:00:39,530
Now, as the name implies, think little command.

12
00:00:39,530 --> 00:00:43,160
Cmdlets are designed to do one small thing like stop a

13
00:00:43,160 --> 00:00:45,940
service or create a virtual machine.

14
00:00:45,940 --> 00:00:49,650
These are compiled programs, which means you can't view the source,

15
00:00:49,650 --> 00:00:54,190
although PowerShell is now open source, so if you have some C# skills,

16
00:00:54,190 --> 00:00:57,240
you can browse through the source files on GitHub.

17
00:00:57,240 --> 00:00:59,270
All you have to know is that when you see the word

18
00:00:59,270 --> 00:01:02,040
cmdlet that you know what that means.

19
00:01:02,040 --> 00:01:05,190
A function is very similar to a cmdlet.

20
00:01:05,190 --> 00:01:09,070
Often you can't really tell if you're running a cmdlet or a function,

21
00:01:09,070 --> 00:01:10,840
and it really doesn't matter.

22
00:01:10,840 --> 00:01:14,680
Almost all functions are written in PowerShell scripting language,

23
00:01:14,680 --> 00:01:17,240
and you can easily view the source.

24
00:01:17,240 --> 00:01:21,440
Eventually, you'll learn to create your own PowerShell functions.

25
00:01:21,440 --> 00:01:22,750
For our purposes,

26
00:01:22,750 --> 00:01:27,940
I'll refer to functions and cmdlets generally as PowerShell commands.

27
00:01:27,940 --> 00:01:30,940
Another type of command is script.

28
00:01:30,940 --> 00:01:35,030
This is a text file written with a ps1 file extension,

29
00:01:35,030 --> 00:01:38,540
and it's written using PowerShell scripting language.

30
00:01:38,540 --> 00:01:42,640
At its simplest, it is really nothing more than a fancy batch file.

31
00:01:42,640 --> 00:01:45,440
Instead of typing commands interactively,

32
00:01:45,440 --> 00:01:49,140
you can put them in the script file and just run the script.

33
00:01:49,140 --> 00:01:51,960
Of course, there's a lot more that you can do with scripting,

34
00:01:51,960 --> 00:01:54,240
but that's a whole other course.

35
00:01:54,240 --> 00:01:57,120
The last command definition is application.

36
00:01:57,120 --> 00:02:01,220
Now this is typically any program or executable that's found in

37
00:02:01,220 --> 00:02:06,340
your system path like notepad.exe or ipconfig.

38
00:02:06,340 --> 00:02:07,020
In fact,

39
00:02:07,020 --> 00:02:10,270
you can run almost any command‑line tool from a PowerShell

40
00:02:10,270 --> 00:02:14,110
prompt. Feel you need to use the netstat command? Even though

41
00:02:14,110 --> 00:02:15,620
there is a powerful equivalent,

42
00:02:15,620 --> 00:02:19,240
you can keep running netstat just like you always have.

43
00:02:19,240 --> 00:02:22,540
Now, as a transition to PowerShell, you can take this further.

44
00:02:22,540 --> 00:02:26,390
You can still run your batch and VBScript files right from a PowerShell

45
00:02:26,390 --> 00:02:31,230
prompt. Need to run something like Python or Ruby? No problem.

46
00:02:31,230 --> 00:02:33,130
If you can run it at a C prompt,

47
00:02:33,130 --> 00:02:37,310
you can most likely run it in PowerShell. One of the reasons

48
00:02:37,310 --> 00:02:39,620
that PowerShell is easy to learn, trust me,

49
00:02:39,620 --> 00:02:42,740
it really is, is because PowerShell commands follow

50
00:02:42,740 --> 00:02:45,540
a standard naming convention.

51
00:02:45,540 --> 00:02:48,460
Remember, commands mean cmdlets and functions.

52
00:02:48,460 --> 00:02:52,340
PowerShell scripts can have whatever name you want to give them.

53
00:02:52,340 --> 00:02:58,240
PowerShell commands are supposed to follow a verb‑noun naming pattern.

54
00:02:58,240 --> 00:03:03,560
The noun is the singular version of the thing that the cmdlet is working with,

55
00:03:03,560 --> 00:03:10,950
like file, service, or ACL. The verb comes from a list of standard .NET verbs,

56
00:03:10,950 --> 00:03:15,240
most of which are pretty basic like get, set, and remove.

57
00:03:15,240 --> 00:03:17,800
Now PowerShell has a command called Get‑Verb,

58
00:03:17,800 --> 00:03:20,060
which will do exactly what the name suggests.

59
00:03:20,060 --> 00:03:22,740
It will get a verb, although, as you'll see,

60
00:03:22,740 --> 00:03:26,740
it's pretty simple to get all of the verbs at the same time.

61
00:03:26,740 --> 00:03:32,140
Now, let me point out that this naming convention is not a hard and fast rule.

62
00:03:32,140 --> 00:03:35,720
It is possible for someone to make a PowerShell command

63
00:03:35,720 --> 00:03:38,140
called something like Erase‑Files.

64
00:03:38,140 --> 00:03:40,640
That name does not follow the rules.

65
00:03:40,640 --> 00:03:44,760
Fortunately, the PowerShell team at Microsoft does follow the naming guidelines,

66
00:03:44,760 --> 00:03:49,740
and a lot of other people who make cmdlets do follow those rules, so it is much

67
00:03:49,740 --> 00:03:54,140
easier to find or even guess the name of commands because of this naming

68
00:03:54,140 --> 00:03:58,390
convention. There is another way commands can be called,

69
00:03:58,390 --> 00:04:01,140
and that is by an alias.

70
00:04:01,140 --> 00:04:01,450
Now,

71
00:04:01,450 --> 00:04:05,600
an alias is technically nothing more than an alternate name for a

72
00:04:05,600 --> 00:04:09,000
command. Under the hood and technically speaking,

73
00:04:09,000 --> 00:04:14,740
this is just another command type to go along with function and cmdlet.

74
00:04:14,740 --> 00:04:17,010
But aliases tend to be easier to use.

75
00:04:17,010 --> 00:04:19,250
They're often shorter, which means less typing,

76
00:04:19,250 --> 00:04:25,240
which a lot of people like. Aliases often exist also as transition tools.

77
00:04:25,240 --> 00:04:29,230
For example, in PowerShell, you can use the dir command to list files,

78
00:04:29,230 --> 00:04:32,540
just as you did from a dos or cmd prompt.

79
00:04:32,540 --> 00:04:35,520
But you aren't really running the dir command.

80
00:04:35,520 --> 00:04:39,540
You are running a PowerShell command called Get‑ChildItem.

81
00:04:39,540 --> 00:04:43,110
Using the dir alias makes things a little bit easier for you till

82
00:04:43,110 --> 00:04:46,260
you learn the PowerShell way to list files.

83
00:04:46,260 --> 00:04:50,940
How do you think you could get a list of aliases in PowerShell?

84
00:04:50,940 --> 00:04:58,000
Well, yeah, it's really that easy, and I'll cover all of this and more a little bit later in the demonstrations.

