1
00:00:00,940 --> 00:00:04,570
When compared to formatting tables and lists, this last

2
00:00:04,570 --> 00:00:07,230
format style that I want to bring to your attention being

3
00:00:07,230 --> 00:00:10,040
format‑wide, it's definitely used less,

4
00:00:10,040 --> 00:00:12,650
but it can be useful in specific scenarios,

5
00:00:12,650 --> 00:00:14,540
so I want you to be across it.

6
00:00:14,540 --> 00:00:20,360
Let's take a look. If we bring up our trusty help again with help Format‑Wide,

7
00:00:20,360 --> 00:00:24,620
you'll see that format‑wide formats objects as a wide table that

8
00:00:24,620 --> 00:00:29,140
displays only one property of each object being formatted.

9
00:00:29,140 --> 00:00:33,540
It's got some similar parameters that format table and format list have.

10
00:00:33,540 --> 00:00:40,840
And if I run Get‑Alias ‑Definition format‑wide, it has an alias of fw.

11
00:00:40,840 --> 00:00:44,140
Okay, let's just run this and see what it does.

12
00:00:44,140 --> 00:00:48,980
We'll go with Get‑Process and pipe that to format‑wide. As promised by the

13
00:00:48,980 --> 00:00:52,000
help, we've got just a single property of each object,

14
00:00:52,000 --> 00:00:52,880
which in this case,

15
00:00:52,880 --> 00:00:56,790
is the process name and it's formatted that on the screen in

16
00:00:56,790 --> 00:01:01,080
this kind of wide table view. Before we play around with any of

17
00:01:01,080 --> 00:01:03,170
the other parameters for format‑wide,

18
00:01:03,170 --> 00:01:06,170
how do you think it decided which property to show us, by

19
00:01:06,170 --> 00:01:09,040
default, for the process object type.

20
00:01:09,040 --> 00:01:11,270
If you're thinking that is defined in the format

21
00:01:11,270 --> 00:01:14,340
definitions, you are absolutely correct.

22
00:01:14,340 --> 00:01:18,650
Let's take a quick look at the format data for the process object type and we

23
00:01:18,650 --> 00:01:23,090
can do that by opening the XML file that we exported a couple of clips ago

24
00:01:23,090 --> 00:01:27,040
containing the format instructions for a process object.

25
00:01:27,040 --> 00:01:33,060
So I'll run notepad C:\Docs and then process.xml, and let

26
00:01:33,060 --> 00:01:36,530
me make that full screen, and scroll down to the very last

27
00:01:36,530 --> 00:01:38,440
view that's defined here.

28
00:01:38,440 --> 00:01:42,840
We can see that it's a wide view and check out this line here.

29
00:01:42,840 --> 00:01:47,120
The WideItem that's defined is the ProcessName property so

30
00:01:47,120 --> 00:01:49,640
it's not just luck that you're being shown the ProcessName

31
00:01:49,640 --> 00:01:51,440
as the default property.

32
00:01:51,440 --> 00:01:55,640
Let's jump back to the console and check out a few of the other parameters.

33
00:01:55,640 --> 00:01:58,740
So Get‑Process, pipe that to Format‑Wide,

34
00:01:58,740 --> 00:02:03,290
let's check out AutoSize first. So the AutoSize will fit the results on the

35
00:02:03,290 --> 00:02:07,540
display as best it can and that looks pretty good to me.

36
00:02:07,540 --> 00:02:10,620
There is a parameter named column that can be used to hard define

37
00:02:10,620 --> 00:02:13,740
how many columns format‑wide will output to.

38
00:02:13,740 --> 00:02:21,190
So let's try 3 and that looks okay. Let's try 5. Now it mostly looks okay,

39
00:02:21,190 --> 00:02:23,570
but note down here to the right that one of these

40
00:02:23,570 --> 00:02:25,840
values is now starting to get cut off.

41
00:02:25,840 --> 00:02:30,540
That's why autosize determined that four columns was best for this output.

42
00:02:30,540 --> 00:02:34,880
Now you could do something like 20, which is not really going to be very useful,

43
00:02:34,880 --> 00:02:35,480
right?

44
00:02:35,480 --> 00:02:38,040
So just be careful what you wish for.

45
00:02:38,040 --> 00:02:41,270
All of these results have been displaying the process name, but

46
00:02:41,270 --> 00:02:44,890
we can override which property is being shown by format wide by

47
00:02:44,890 --> 00:02:46,840
using the property parameter.

48
00:02:46,840 --> 00:02:49,340
Let's ask for the ID.

49
00:02:49,340 --> 00:02:52,830
Cool. It looks okay, but there's a lot of wasted screen there.

50
00:02:52,830 --> 00:02:55,240
Let's set that to four columns.

51
00:02:55,240 --> 00:02:57,540
Yeah, that looks a little bit better.

52
00:02:57,540 --> 00:03:01,420
Lastly, format‑wide does have the ability to group objects as

53
00:03:01,420 --> 00:03:05,680
well similar to the other formatting commands. So if we roll with

54
00:03:05,680 --> 00:03:09,790
Get‑Service this time and remember, we need to sort it before grouping,

55
00:03:09,790 --> 00:03:12,340
so I'll pipe that across to sort object,

56
00:03:12,340 --> 00:03:16,000
and I want to sort on the property named Status so results get

57
00:03:16,000 --> 00:03:19,440
grouped based on whether the service is stopped or running.

58
00:03:19,440 --> 00:03:22,920
From there, we can pipe that down to format‑wide and we can

59
00:03:22,920 --> 00:03:25,440
group by the Status property.

60
00:03:25,440 --> 00:03:28,850
If I scroll up a little bit here, you can see that all of these

61
00:03:28,850 --> 00:03:31,840
services down here that are grouped are running.

62
00:03:31,840 --> 00:03:38,000
And if I scroll all the way up to the top, all of these ones group together at the top are stopped.

