1
00:00:01,790 --> 00:00:03,990
So that's enough talk, enough slides.

2
00:00:03,990 --> 00:00:05,470
Let's jump into PowerShell,

3
00:00:05,470 --> 00:00:11,390
and let me give you some examples of how to use PowerShell help.

4
00:00:11,390 --> 00:00:16,380
All right, so let's take a look at PowerShell help in PowerShell 7.

5
00:00:16,380 --> 00:00:19,990
Now just so you know, I'm running PowerShell 7 in a Windows terminal.

6
00:00:19,990 --> 00:00:22,580
It makes no difference whether you use a Windows

7
00:00:22,580 --> 00:00:25,090
terminal or the PowerShell console,

8
00:00:25,090 --> 00:00:28,190
the commands and everything is going to behave the same.

9
00:00:28,190 --> 00:00:34,010
So let me start here by just doing get‑help for the get‑service command.

10
00:00:34,010 --> 00:00:39,270
And this is a brand new installation of PowerShell 7 on Windows 10.

11
00:00:39,270 --> 00:00:41,680
So you can see, it goes through very quickly,

12
00:00:41,680 --> 00:00:44,710
and I get that little remarks at the end saying hey,

13
00:00:44,710 --> 00:00:47,570
PowerShell does not have all of the updated help.

14
00:00:47,570 --> 00:00:49,190
It's only displaying partial help.

15
00:00:49,190 --> 00:00:52,770
And it gives me instructions there on how to run Update‑Help.

16
00:00:52,770 --> 00:00:56,160
So I'm going to go ahead and run Update‑Help right now,

17
00:00:56,160 --> 00:00:58,310
and then we'll talk about it while this is running

18
00:00:58,310 --> 00:01:00,830
because this will take a few minutes.

19
00:01:00,830 --> 00:01:06,140
So a few things here about Update‑Help, and you can see that it's working there.

20
00:01:06,140 --> 00:01:10,270
There is no indication when you are running PowerShell that

21
00:01:10,270 --> 00:01:14,010
there is new help to download other than what you see here

22
00:01:14,010 --> 00:01:16,210
when you have a new installation.

23
00:01:16,210 --> 00:01:20,490
In order to update help, you must be running in an elevated PowerShell session,

24
00:01:20,490 --> 00:01:22,910
meaning you must run it as administrator.

25
00:01:22,910 --> 00:01:26,370
And now you can see there in the title bar of my terminal,

26
00:01:26,370 --> 00:01:29,440
I'm running PowerShell as administrator.

27
00:01:29,440 --> 00:01:30,420
So that's the first thing.

28
00:01:30,420 --> 00:01:34,000
You also need to know that when you run update‑help,

29
00:01:34,000 --> 00:01:35,990
what this is doing is going out,

30
00:01:35,990 --> 00:01:41,830
typically to Microsoft or wherever the link in the help is pointing to and

31
00:01:41,830 --> 00:01:45,400
downloading the CAB file that have the help documentation.

32
00:01:45,400 --> 00:01:51,050
Now by default, Microsoft really only wants you to go out once per day.

33
00:01:51,050 --> 00:01:55,070
So if I were to run Update‑Help again immediately after this,

34
00:01:55,070 --> 00:01:59,850
nothing really is going to happen unless you use the ‑Force parameter.

35
00:01:59,850 --> 00:02:03,320
So if you're testing and need to make sure you get help updated,

36
00:02:03,320 --> 00:02:06,040
include the ‑Force parameter.

37
00:02:06,040 --> 00:02:09,840
‑Force will also skip any sort of version checking,

38
00:02:09,840 --> 00:02:13,450
and it will also download files that exceed 1GB in size,

39
00:02:13,450 --> 00:02:16,790
although I'm not sure I've ever really come across that.

40
00:02:16,790 --> 00:02:18,670
Now as this is running,

41
00:02:18,670 --> 00:02:24,430
you can expect when it's finished to see some errors because sometimes

42
00:02:24,430 --> 00:02:28,750
there will be links in the PowerShell help that point to a place on the

43
00:02:28,750 --> 00:02:31,740
internet or on Microsoft that don't exist.

44
00:02:31,740 --> 00:02:36,340
Maybe they're just a placeholder for future content or the link is there,

45
00:02:36,340 --> 00:02:38,030
but has not been modified.

46
00:02:38,030 --> 00:02:43,040
So we're just going to let this run here, and this may take a few more minutes.

47
00:02:43,040 --> 00:02:45,480
And when it comes back, oh, it's all finished there.

48
00:02:45,480 --> 00:02:48,780
You can see that I got some error messages there.

49
00:02:48,780 --> 00:02:52,340
So a few error messages are to be expected.

50
00:02:52,340 --> 00:02:54,220
If you get a lot of error messages,

51
00:02:54,220 --> 00:02:58,740
that means you probably are not running as administrator.

52
00:02:58,740 --> 00:03:02,080
So let's take a look here at Update‑Help, the help for us.

53
00:03:02,080 --> 00:03:05,260
So you can see that you can specify a different module.

54
00:03:05,260 --> 00:03:08,340
You can specify different cultures.

55
00:03:08,340 --> 00:03:12,600
You can specify the ‑Force.

56
00:03:12,600 --> 00:03:17,590
The More is what you get when you run the help command so that pages it.

57
00:03:17,590 --> 00:03:20,780
Get‑Help just runs the full thing without any sort of paging.

58
00:03:20,780 --> 00:03:25,470
So if you're not used to the More command, Enter just go to the next page.

59
00:03:25,470 --> 00:03:27,500
Spacebar goes to the next page.

60
00:03:27,500 --> 00:03:30,560
Sorry, Enter just goes the next line, Spacebar is next page.

61
00:03:30,560 --> 00:03:34,210
Or you can just do q to quit and get back to your prompt.

62
00:03:34,210 --> 00:03:38,120
So just to show you here, I'm going to rerun Update‑Help.

63
00:03:38,120 --> 00:03:40,620
And I'm just going to get a single module.

64
00:03:40,620 --> 00:03:44,070
And just to demonstrate, I'm going to specify the German culture,

65
00:03:44,070 --> 00:03:47,380
and I'll use the ‑Force for this to go out again.

66
00:03:47,380 --> 00:03:50,050
So this is going to go out and this failed because there

67
00:03:50,050 --> 00:03:53,830
is no content for the German culture.

68
00:03:53,830 --> 00:03:57,130
You'll find that a lot of help content pretty much defaults to the

69
00:03:57,130 --> 00:04:00,890
English US, although you can always check if you have a different

70
00:04:00,890 --> 00:04:04,900
culture. You can try specifying your particular culture.

71
00:04:04,900 --> 00:04:11,000
I don't have a culture‑specific machine to really test with or show you.

72
00:04:11,000 --> 00:04:12,790
All right, so let's clear the screen here.

73
00:04:12,790 --> 00:04:15,300
Now let's go back to our original command.

74
00:04:15,300 --> 00:04:18,740
So we're going to do Get‑Help on Get‑Service. So

75
00:04:18,740 --> 00:04:21,590
this scrolls all the way through.

76
00:04:21,590 --> 00:04:23,150
And if I scroll up here,

77
00:04:23,150 --> 00:04:29,280
you can see I now have NAME, SYNOPSIS, SYNTAX, DESCRIPTION, RELATED LINKS.

78
00:04:29,280 --> 00:04:33,950
I no longer have that same error message saying that I have to update help.

79
00:04:33,950 --> 00:04:41,940
So I now have help, and I can use it and get all the information that I need.

80
00:04:41,940 --> 00:04:46,380
Now another thing that you can do with Update‑Help is you can

81
00:04:46,380 --> 00:04:50,390
save it locally and then install it locally.

82
00:04:50,390 --> 00:04:52,960
You may want to do this if you are in a team

83
00:04:52,960 --> 00:04:55,280
environment because there's no reason for,

84
00:04:55,280 --> 00:04:55,540
you know,

85
00:04:55,540 --> 00:05:00,200
10 people to all go out to Microsoft where all you have to do is just

86
00:05:00,200 --> 00:05:04,170
save the help locally and then install it locally.

87
00:05:04,170 --> 00:05:06,840
So there is a command that you can run.

88
00:05:06,840 --> 00:05:09,430
We'll get to it here in a moment. So I'm going to save all my help

89
00:05:09,430 --> 00:05:13,380
and make a directory called help on my local hard drive. And I'm

90
00:05:13,380 --> 00:05:17,000
going to use the command Save‑Help.

91
00:05:17,000 --> 00:05:20,550
I'm going to let you look at the help eventually to see how to use this.

92
00:05:20,550 --> 00:05:23,960
But I'm going to run Save‑Help and specify the module.

93
00:05:23,960 --> 00:05:26,150
I'm just going to do a couple sample modules,

94
00:05:26,150 --> 00:05:29,780
specify the destination, and do Force because I've

95
00:05:29,780 --> 00:05:33,440
already kind of run Update‑Help once.

96
00:05:33,440 --> 00:05:37,130
So this is going out now and saving and downloading all of the

97
00:05:37,130 --> 00:05:42,060
content, all these CAB files to the local hard drive, to the

98
00:05:42,060 --> 00:05:45,880
destination that I specify. That destination could be a UNC or it

99
00:05:45,880 --> 00:05:48,740
could be some team drive or whatever you want.

100
00:05:48,740 --> 00:05:52,440
And again, there is an error message there about PSReadline,

101
00:05:52,440 --> 00:05:56,420
although if I look at the help directory,

102
00:05:56,420 --> 00:05:58,970
I can actually see that I've actually got content.

103
00:05:58,970 --> 00:06:03,040
So I'm not quite sure where that error message is coming from.

104
00:06:03,040 --> 00:06:06,070
One thing about Save‑Help though, this is very important,

105
00:06:06,070 --> 00:06:11,080
Save‑Help will only download help for modules. And in this

106
00:06:11,080 --> 00:06:12,980
case, I specified the modules.

107
00:06:12,980 --> 00:06:15,740
If I just did Save‑Help without specifying anything,

108
00:06:15,740 --> 00:06:17,700
it would then do all of the modules.

109
00:06:17,700 --> 00:06:20,700
But this is only going to install help for modules

110
00:06:20,700 --> 00:06:24,460
on my machine or, in this case, Save‑Help is what I'm running.

111
00:06:24,460 --> 00:06:27,430
Keep this in mind because if someone else then goes to

112
00:06:27,430 --> 00:06:30,030
update the help and they have a different module, they're

113
00:06:30,030 --> 00:06:31,400
not going to get the updated help.

114
00:06:31,400 --> 00:06:33,270
So that is one potential drawback.

115
00:06:33,270 --> 00:06:37,000
You kind of need to make sure that when you are saving help,

116
00:06:37,000 --> 00:06:40,810
whoever is going to be up loading or updating help from your

117
00:06:40,810 --> 00:06:45,640
source that you all have the same modules.

118
00:06:45,640 --> 00:06:49,600
So now on another machine, I could run Update‑Help. Again, the

119
00:06:49,600 --> 00:06:53,820
modules, I'm just using my samples here, specifying the source path.

120
00:06:53,820 --> 00:06:57,650
And now PowerShell, instead of going out to Microsoft or out to the

121
00:06:57,650 --> 00:06:59,550
vendor wherever the link is pointing to,

122
00:06:59,550 --> 00:07:02,330
we'll download the help files from that source path and

123
00:07:02,330 --> 00:07:05,190
then save them locally to my machine. So that really kind

124
00:07:05,190 --> 00:07:09,110
of speeds up the whole process.

125
00:07:09,110 --> 00:07:12,320
So now I can run help for get‑psreadline option, one of

126
00:07:12,320 --> 00:07:17,810
the commands on the PSReadline module. And I have

127
00:07:17,810 --> 00:07:20,310
everything there and same thing here.

128
00:07:20,310 --> 00:07:23,400
Let's look at get‑smbshare, another command from the other

129
00:07:23,400 --> 00:07:27,360
module. And I have everything that I am expecting.

130
00:07:27,360 --> 00:07:30,010
So I know now that Save‑Help worked,

131
00:07:30,010 --> 00:07:35,430
and I'm real improved much good to go. As a note, although I'm not going to

132
00:07:35,430 --> 00:07:37,940
really get into because it's not that kind of course,

133
00:07:37,940 --> 00:07:43,040
you can also use group policy to configure those source paths.

134
00:07:43,040 --> 00:07:46,250
So if you want to make sure that people are downloading

135
00:07:46,250 --> 00:07:48,620
and saving help from an internal source,

136
00:07:48,620 --> 00:07:51,720
you can configure that through group policy.

137
00:07:51,720 --> 00:07:56,130
One last thing here about Update‑Help before we move on to the next demo,

138
00:07:56,130 --> 00:08:01,530
Update and Save‑Help are version‑specific, meaning this also will work in

139
00:08:01,530 --> 00:08:04,530
Windows PowerShell. But when you do Update or Save‑Help,

140
00:08:04,530 --> 00:08:08,960
you're going to get the PowerShell 5 or 5.1 versions of help,

141
00:08:08,960 --> 00:08:11,540
not the PowerShell 7 versions.

142
00:08:11,540 --> 00:08:13,010
If by chance you still had, say,

143
00:08:13,010 --> 00:08:15,890
an old PowerShell core machine running PowerShell 6.

144
00:08:15,890 --> 00:08:19,270
something, again Update‑Help, Save‑Help is going to get that

145
00:08:19,270 --> 00:08:22,280
version‑specific help of PowerShell.

146
00:08:22,280 --> 00:08:30,000
So keep that in mind if you end up building some sort of mechanism to download and save help.

