1
00:00:00,040 --> 00:00:04,270
Now, another option that we've got is instead of using the standard

2
00:00:04,270 --> 00:00:10,900
Enable‑PSRemoting and QuickConfig, we can utilize SSH. Now,

3
00:00:10,900 --> 00:00:11,280
of course,

4
00:00:11,280 --> 00:00:14,860
remember the two ways of communicating are the HTTP and

5
00:00:14,860 --> 00:00:17,090
the HTTPS, which is the standard ones,

6
00:00:17,090 --> 00:00:23,060
which is also mapped into some TCP ports, but let's say I wanted to prepare

7
00:00:23,060 --> 00:00:28,510
the Windows 10 environment, for example, to be able to do SSH remoting. So

8
00:00:28,510 --> 00:00:32,290
what we can do is I'm going to flick back to the Windows 10 machine now so

9
00:00:32,290 --> 00:00:37,470
that we can execute some commands there. So we're back on the client. I'm just

10
00:00:37,470 --> 00:00:39,940
going to clear the screen here.

11
00:00:39,940 --> 00:00:42,940
Now what we can do is in order to enable this,

12
00:00:42,940 --> 00:00:48,960
we need to add some specific capabilities to the Windows 10 device. So we

13
00:00:48,960 --> 00:00:53,480
can do this by adding some Windows capabilities, so I'm going to add what's

14
00:00:53,480 --> 00:00:58,800
called the OpenSSH.Client, and then what I'll do is do the same one again,

15
00:00:58,800 --> 00:01:02,690
but this time I'm going to say .Server,

16
00:01:02,690 --> 00:01:04,340
oh I've got too many dots there, but I'm going to say

17
00:01:04,340 --> 00:01:07,430
.Server and add the server to it as well.

18
00:01:07,430 --> 00:01:11,040
Okay, so we have both clients now installed.

19
00:01:11,040 --> 00:01:15,530
What I'm then going to do is use PowerShell to actually go ahead and

20
00:01:15,530 --> 00:01:18,880
set the service, which would be the SSH service.

21
00:01:18,880 --> 00:01:23,830
So you can see I'm doing Set‑Service sshd, and set that to Automatic.

22
00:01:23,830 --> 00:01:24,860
Now notice what happens.

23
00:01:24,860 --> 00:01:28,530
It says, well that service doesn't exist and it wasn't

24
00:01:28,530 --> 00:01:30,620
found on the server. So that's good.

25
00:01:30,620 --> 00:01:34,240
So we can go to Services here,

26
00:01:34,240 --> 00:01:38,730
we can then go into the Services itself, and we'll change it to the

27
00:01:38,730 --> 00:01:41,680
standard one just because it's easier to read, and then we can scroll

28
00:01:41,680 --> 00:01:46,620
all the way down looking for that specific service to see whether

29
00:01:46,620 --> 00:01:48,750
that service has been installed.

30
00:01:48,750 --> 00:01:53,850
Now, of course, if that service doesn't display and isn't listed here,

31
00:01:53,850 --> 00:01:56,470
then that will mean that probably the environment needs to be

32
00:01:56,470 --> 00:02:00,070
rebooted before we can actually start that service.

33
00:02:00,070 --> 00:02:03,820
So I'm just going to reboot my machine, and then we'll connect back and ensure

34
00:02:03,820 --> 00:02:10,590
that the service is started. So our machine is rebooted, so let me launch my

35
00:02:10,590 --> 00:02:15,360
console again, Windows Terminal, Run as administrator.

36
00:02:15,360 --> 00:02:18,730
We'll make that full screen, zoom in a little bit, and then we'll

37
00:02:18,730 --> 00:02:24,100
clear. Okay, and next thing is to start the service to make sure

38
00:02:24,100 --> 00:02:29,130
that it actually runs, sshd, okay.

39
00:02:29,130 --> 00:02:36,460
And I'm going to set the service to actually be Automatic, like we tried

40
00:02:36,460 --> 00:02:48,040
to last time, ‑StartupType, and we'll say Automatic.

41
00:02:48,040 --> 00:02:56,140
Okay, so we've set it to be automatic now. Now that we have that configured,

42
00:02:56,140 --> 00:03:01,620
so we have that running, now what we can do is I can then on this machine,

43
00:03:01,620 --> 00:03:07,340
I can then say Install‑Module.

44
00:03:07,340 --> 00:03:11,290
And then what we have available to us is we have the

45
00:03:11,290 --> 00:03:21,840
Microsoft.PowerShell.RemotingTools module available to us. So we

46
00:03:21,840 --> 00:03:25,550
can install the module, we can then import the module. Now of

47
00:03:25,550 --> 00:03:27,570
course we have to make sure it's the right version of PowerShell,

48
00:03:27,570 --> 00:03:30,100
so I'm using the Windows PowerShell.

49
00:03:30,100 --> 00:03:34,230
You'll notice in my terminal here I've got the drop‑down that says Windows,

50
00:03:34,230 --> 00:03:38,010
and you've got Command Prompt and PowerShell. First thing, obviously, is I'm

51
00:03:38,010 --> 00:03:41,460
trying to get it from a NuGet package, so I need to kind of update the

52
00:03:41,460 --> 00:03:45,030
provider. This will then go and make sure that works,

53
00:03:45,030 --> 00:03:47,600
then it will validate that, and then if my

54
00:03:47,600 --> 00:03:51,040
Microsoft.PowerShell.RemotingTools module is available,

55
00:03:51,040 --> 00:03:53,430
then it will try to download that too. So we'll give

56
00:03:53,430 --> 00:03:58,450
it a second to complete. Okay, same thing again, I'd like to add that again,

57
00:03:58,450 --> 00:04:04,740
press Yes. Okay, it's gone to the PSGallery, and now we installed it.

58
00:04:04,740 --> 00:04:11,170
So I'm going to change from my Install here to Import,

59
00:04:11,170 --> 00:04:14,320
so I'm going to import that module. Now, of course, notice when it comes

60
00:04:14,320 --> 00:04:18,520
back it says the version of PowerShell on this computer is blah and you

61
00:04:18,520 --> 00:04:22,620
need to have a more up‑to‑date version, which is version 6.0,

62
00:04:22,620 --> 00:04:23,650
which is perfectly fine.

63
00:04:23,650 --> 00:04:27,120
So we'll need to update our PowerShell or what we could do

64
00:04:27,120 --> 00:04:32,640
here is simply just go to PowerShell, which is PowerShell 7.0 at this point,

65
00:04:32,640 --> 00:04:35,350
which I think this is the latest version, there we go,

66
00:04:35,350 --> 00:04:43,280
7.13, and what I can do is go and say Import‑Module, go

67
00:04:43,280 --> 00:04:47,000
over to here like so. You can import it.

68
00:04:47,000 --> 00:04:50,080
So because I'm using a newer version of PowerShell in this window,

69
00:04:50,080 --> 00:04:51,640
it lets me import.

70
00:04:51,640 --> 00:04:56,890
So then at this point I can say Enable. Now remember how we used

71
00:04:56,890 --> 00:05:02,660
PSRemoting, I now get to use something called Enable‑SSHRemoting. And

72
00:05:02,660 --> 00:05:05,740
if I look at the extra kind of tab options,

73
00:05:05,740 --> 00:05:07,750
you can see I've got a few different configuration

74
00:05:07,750 --> 00:05:09,890
options, as well as some other entries.

75
00:05:09,890 --> 00:05:13,920
So I'm going to say Verbose, press Enter, and then notice what it does.

76
00:05:13,920 --> 00:05:16,690
You can see it's checking the Platform information,

77
00:05:16,690 --> 00:05:19,610
it's going to validate any of the configuration, and now it's

78
00:05:19,610 --> 00:05:21,960
going to go ahead and try to configure that one.

79
00:05:21,960 --> 00:05:26,440
It creates the configuration file that contains the entries that are needed.

80
00:05:26,440 --> 00:05:30,480
I'm going to say Yes to enable that service, and now it says, okay,

81
00:05:30,480 --> 00:05:33,100
it's created it, it's ready to go, and now we need

82
00:05:33,100 --> 00:05:36,140
to restart the service itself.

83
00:05:36,140 --> 00:05:40,260
So I'm going to say Restart‑Service ‑name, and then

84
00:05:40,260 --> 00:05:44,540
sshd, so the service will get restarted.

85
00:05:44,540 --> 00:05:48,950
Now, that means that we have configuration information ready. There's

86
00:05:48,950 --> 00:05:53,240
a config file. So if I just take this value here,

87
00:05:53,240 --> 00:05:58,540
I'm actually just going to launch my window. Let me just go into the C drive,

88
00:05:58,540 --> 00:06:02,640
and I'm going to change my view so I can see hidden ones,

89
00:06:02,640 --> 00:06:06,430
go to ProgramData. You'll see when I go to ProgramData we can

90
00:06:06,430 --> 00:06:09,370
go to ssh, and then if I move across here,

91
00:06:09,370 --> 00:06:13,410
ssh_config. If I just right‑click here,

92
00:06:13,410 --> 00:06:17,570
choose Open With. I'm going to choose Notepad, and then open

93
00:06:17,570 --> 00:06:19,440
it, and then we'll make it a little bigger.

94
00:06:19,440 --> 00:06:22,140
You can see that we have the port details,

95
00:06:22,140 --> 00:06:23,460
the listener information,

96
00:06:23,460 --> 00:06:27,050
you'll see Authentication, and some of the basic bits and pieces

97
00:06:27,050 --> 00:06:32,450
that are configured for SSH. What that means is that I'm now able to

98
00:06:32,450 --> 00:06:38,760
SSH for Windows 10. So I can then say, well, here's the latest version,

99
00:06:38,760 --> 00:06:41,730
use any of the ssh clients that I want to use,

100
00:06:41,730 --> 00:06:43,320
whether I'm using, you know,

101
00:06:43,320 --> 00:06:47,250
some of the third‑party tools or another Windows device to get to it,

102
00:06:47,250 --> 00:06:51,590
but I can now SSH directly to this machine as part of that.

103
00:06:51,590 --> 00:06:56,360
So, enabling PowerShell remoting can be done in various different ways.

104
00:06:56,360 --> 00:06:59,440
The first way, obviously, that we saw was to use

105
00:06:59,440 --> 00:07:01,940
setting the WSMan configuration,

106
00:07:01,940 --> 00:07:04,710
which is a QuickConfig way of doing it, or it could be

107
00:07:04,710 --> 00:07:13,000
done using installing modules, using SSH or it can be done by doing Enable‑PSRemoting.

