1
00:00:01,040 --> 00:00:01,920
Hey everyone,

2
00:00:01,920 --> 00:00:06,540
and welcome back to the next step in learning how to put PowerShell to work.

3
00:00:06,540 --> 00:00:07,930
In this part of the course,

4
00:00:07,930 --> 00:00:10,430
we're going to dive a bit deeper into working with

5
00:00:10,430 --> 00:00:12,440
objects in the PowerShell pipeline.

6
00:00:12,440 --> 00:00:16,320
As you'll see, once you understand core PowerShell concepts,

7
00:00:16,320 --> 00:00:18,260
you can apply them to anything.

8
00:00:18,260 --> 00:00:22,240
It doesn't matter if it's a process or an Azure Virtual Machine.

9
00:00:22,240 --> 00:00:26,260
In most situations, especially when running PowerShell interactively,

10
00:00:26,260 --> 00:00:30,540
you want to let the PowerShell pipeline do a lot of the heavy lifting.

11
00:00:30,540 --> 00:00:33,010
Don't think about working with one thing at a time.

12
00:00:33,010 --> 00:00:36,340
Work with all of them at once.

13
00:00:36,340 --> 00:00:37,420
In this module,

14
00:00:37,420 --> 00:00:40,300
I want to go through some core PowerShell commands that

15
00:00:40,300 --> 00:00:42,740
you'll most likely use all the time.

16
00:00:42,740 --> 00:00:45,520
These are commands that treat all objects equally.

17
00:00:45,520 --> 00:00:46,180
In other words,

18
00:00:46,180 --> 00:00:48,560
a file object is no different than an Active

19
00:00:48,560 --> 00:00:51,120
Directory user or a virtual machine.

20
00:00:51,120 --> 00:00:53,040
Say you need to sort something.

21
00:00:53,040 --> 00:00:55,670
There aren't different sorting commands for files

22
00:00:55,670 --> 00:00:59,340
and users. It's the same command, Sort‑ Object.

23
00:00:59,340 --> 00:01:01,980
The command does exactly what that name implies.

24
00:01:01,980 --> 00:01:06,120
It doesn't care what the object represents. Give it a property name to sort on,

25
00:01:06,120 --> 00:01:07,370
and you're good to go.

26
00:01:07,370 --> 00:01:08,990
The same is true of grouping.

27
00:01:08,990 --> 00:01:12,240
This is a very useful command and one that I use very often.

28
00:01:12,240 --> 00:01:15,910
Grouping is the process of organizing objects into groups or

29
00:01:15,910 --> 00:01:18,290
buckets based on some common property.

30
00:01:18,290 --> 00:01:21,740
Again, the grouping process is the same whether it's a file,

31
00:01:21,740 --> 00:01:23,840
process, or virtual machine.

32
00:01:23,840 --> 00:01:27,110
Another common task, and one you'll be doing often,

33
00:01:27,110 --> 00:01:30,070
is selecting objects or parts of objects.

34
00:01:30,070 --> 00:01:34,440
By this I mean, maybe you're running a command to get a bunch of something,

35
00:01:34,440 --> 00:01:39,640
like Exchange mailboxes, but you really only need the first five items.

36
00:01:39,640 --> 00:01:42,340
Select‑Object is what makes this possible.

37
00:01:42,340 --> 00:01:44,950
This command has other features which will help you

38
00:01:44,950 --> 00:01:48,460
fine tune your PowerShell expression, and I'll get to those shortly.

39
00:01:48,460 --> 00:01:51,360
And lastly, PowerShell has a measurement command.

40
00:01:51,360 --> 00:01:54,960
Often an object will have some property with a numeric value,

41
00:01:54,960 --> 00:01:57,540
like the length or size of a file.

42
00:01:57,540 --> 00:02:01,030
Measure‑Object offers several simple mathematical

43
00:02:01,030 --> 00:02:03,560
measurements based on that value.

44
00:02:03,560 --> 00:02:08,080
To reiterate, we have one command to measure any type of object.

45
00:02:08,080 --> 00:02:11,700
And by the way, all of these commands have aliases,

46
00:02:11,700 --> 00:02:13,870
which is just the verb part of the name,

47
00:02:13,870 --> 00:02:16,240
like group, sort, and measure.

48
00:02:16,240 --> 00:02:22,000
You'll use these commands often and most likely together. We'll see some of that when I get to the demonstration.

