1
00:00:00,940 --> 00:00:03,770
One of the most important concepts for people to learn and

2
00:00:03,770 --> 00:00:08,040
embrace is what I call the PowerShell paradigm.

3
00:00:08,040 --> 00:00:10,970
As I said a moment ago, when you run a command in PowerShell,

4
00:00:10,970 --> 00:00:14,990
you don't have to parse or manipulate any text output.

5
00:00:14,990 --> 00:00:15,580
Instead,

6
00:00:15,580 --> 00:00:19,140
you work with objects. Now don't worry, you don't have to be a developer.

7
00:00:19,140 --> 00:00:23,340
Eventually you'll realize that this is not that difficult.

8
00:00:23,340 --> 00:00:26,190
The objects move through a pipeline.

9
00:00:26,190 --> 00:00:29,650
Each command in your PowerShell expression can do something.

10
00:00:29,650 --> 00:00:33,400
At the end of the pipeline, PowerShell displays your results.

11
00:00:33,400 --> 00:00:37,850
And when it comes a scripting, if you can type it at a prompt,

12
00:00:37,850 --> 00:00:39,840
you can build a script around it.

13
00:00:39,840 --> 00:00:42,600
There's essentially no difference between the commands you type

14
00:00:42,600 --> 00:00:46,400
interactively and what you put into a script file.

15
00:00:46,400 --> 00:00:50,440
The script gives you some flexibility and saves a whole lot of typing.

16
00:00:50,440 --> 00:00:53,120
Here's a taste of what IT pros used to have to deal with when

17
00:00:53,120 --> 00:00:58,080
using VBScript, for example. This is about 20 lines of script

18
00:00:58,080 --> 00:01:02,500
that is not easy to learn or to write. The script has to

19
00:01:02,500 --> 00:01:05,440
essentially parse the results as text.

20
00:01:05,440 --> 00:01:09,080
Now all of this script has been saved to a file and

21
00:01:09,080 --> 00:01:12,140
then executed at a command line.

22
00:01:12,140 --> 00:01:16,260
The result is some text that shows disk usage. Very useful,

23
00:01:16,260 --> 00:01:21,520
but it was a lot of work to get to that result. Now compare all of

24
00:01:21,520 --> 00:01:25,770
that to this one‑line PowerShell command. Even though it looks like a

25
00:01:25,770 --> 00:01:29,440
long line, technically this is one command.

26
00:01:29,440 --> 00:01:33,340
There's no scripting needed, you can type it at a prompt.

27
00:01:33,340 --> 00:01:37,460
And while it may look daunting, especially if you are totally new to PowerShell,

28
00:01:37,460 --> 00:01:41,460
once you learn more about PowerShell's language and syntax,

29
00:01:41,460 --> 00:01:45,960
you'll realize that it is actually pretty easy to understand and write. Now,

30
00:01:45,960 --> 00:01:48,670
if this was something that you wanted to do often, you can create a

31
00:01:48,670 --> 00:01:52,780
PowerShell script and save yourself from typing, or running it at a

32
00:01:52,780 --> 00:01:55,940
prompt interactively to get the same results.

33
00:01:55,940 --> 00:01:59,490
An advantage that I'm not showing is that if I needed to export the

34
00:01:59,490 --> 00:02:02,950
results to say a CSV file or convert it into JSON,

35
00:02:02,950 --> 00:02:06,140
I can add on more PowerShell commands.

36
00:02:06,140 --> 00:02:09,540
You should think of PowerShell as a management engine.

37
00:02:09,540 --> 00:02:12,370
This engine can be exposed interactively or through

38
00:02:12,370 --> 00:02:20,000
scripting. PowerShell is more, much, much more, than just a shell or successor to VBScript.

