1
00:00:00,340 --> 00:00:01,800
[Autogenerated] So let's go back into my

2
00:00:01,800 --> 00:00:03,870
windows 10. Machine on. Well, first, look

3
00:00:03,870 --> 00:00:05,680
at how we connect to remote computers

4
00:00:05,680 --> 00:00:08,260
using W m I. More then retrieve

5
00:00:08,260 --> 00:00:11,390
information from that remote computer on.

6
00:00:11,390 --> 00:00:12,870
Then we'll look at how we can manage the

7
00:00:12,870 --> 00:00:16,710
services on that computer. Okay, so we're

8
00:00:16,710 --> 00:00:18,890
back on the machine now. And of course,

9
00:00:18,890 --> 00:00:20,810
what we want to do here is we actually

10
00:00:20,810 --> 00:00:23,750
want to look at how we can connect to a

11
00:00:23,750 --> 00:00:26,570
different machine using the W my commands.

12
00:00:26,570 --> 00:00:28,060
Now, of course, you can see I've got to

13
00:00:28,060 --> 00:00:29,950
PowerShell tabs open. One is PowerShell

14
00:00:29,950 --> 00:00:32,300
seven on one is regular PowerShell. In

15
00:00:32,300 --> 00:00:34,310
order to use the GitHub, my you'll need to

16
00:00:34,310 --> 00:00:36,840
be used in the regular windows PowerShell.

17
00:00:36,840 --> 00:00:40,290
So if I want to make a connection, then of

18
00:00:40,290 --> 00:00:43,740
course, we need to use GitHub my object.

19
00:00:43,740 --> 00:00:48,310
And then we specify the class that we wish

20
00:00:48,310 --> 00:00:50,710
to use. So I'm going to say operating

21
00:00:50,710 --> 00:00:53,750
system is my class. And then to make it a

22
00:00:53,750 --> 00:00:56,520
remote connection, we simply use local

23
00:00:56,520 --> 00:01:00,990
host for the computer name. And then, of

24
00:01:00,990 --> 00:01:02,570
course, that now connects me. Now, of

25
00:01:02,570 --> 00:01:04,490
course, it's not too remote, one per se,

26
00:01:04,490 --> 00:01:06,430
because I'm connecting to the device that

27
00:01:06,430 --> 00:01:09,420
I'm on. So what about if we wanted to pass

28
00:01:09,420 --> 00:01:12,360
available to that instead, so I could do

29
00:01:12,360 --> 00:01:16,830
computer equals local host. So there's my

30
00:01:16,830 --> 00:01:18,600
variable I can. Then use the same

31
00:01:18,600 --> 00:01:21,940
commanders before and this time we move

32
00:01:21,940 --> 00:01:23,760
that and use computer, and sure enough, it

33
00:01:23,760 --> 00:01:26,310
gets me the same value back. So creating a

34
00:01:26,310 --> 00:01:28,580
connection to a computer is a simple is

35
00:01:28,580 --> 00:01:31,870
using the computer name property on, then

36
00:01:31,870 --> 00:01:33,900
using the computer name? Now, of course,

37
00:01:33,900 --> 00:01:36,510
you can't just randomly connect to any

38
00:01:36,510 --> 00:01:38,980
machine. You'll need to have some kind of

39
00:01:38,980 --> 00:01:41,970
firewall openings on the service

40
00:01:41,970 --> 00:01:45,150
themselves to allow remote connection to

41
00:01:45,150 --> 00:01:47,140
that server. Now, of course, that's a

42
00:01:47,140 --> 00:01:49,540
specific task that would need to be ran

43
00:01:49,540 --> 00:01:52,140
Now, of course, what we can do is when we

44
00:01:52,140 --> 00:01:54,990
initially create our connection, we do

45
00:01:54,990 --> 00:01:58,620
have the ability to pass other parameters

46
00:01:58,620 --> 00:02:00,360
so you'll see here. There's an

47
00:02:00,360 --> 00:02:02,150
impersonation. Once I'm going to set that

48
00:02:02,150 --> 00:02:04,700
to three impersonation means I want to

49
00:02:04,700 --> 00:02:07,500
pass credentials across to it, I can, then

50
00:02:07,500 --> 00:02:10,750
say credential. And whatever the domain

51
00:02:10,750 --> 00:02:13,240
user credentials are I can, then pass that

52
00:02:13,240 --> 00:02:14,650
now There's no point trying this on a

53
00:02:14,650 --> 00:02:16,810
local host. The local host doesn't

54
00:02:16,810 --> 00:02:19,010
actually work that way, so it will

55
00:02:19,010 --> 00:02:21,450
actually fail if we try to do it. So I was

56
00:02:21,450 --> 00:02:24,310
gonna do this one here and clear it. Now,

57
00:02:24,310 --> 00:02:25,670
of course, one of the things that's

58
00:02:25,670 --> 00:02:27,400
interesting is, of course, when we make a

59
00:02:27,400 --> 00:02:29,780
connection to remote machine, we really

60
00:02:29,780 --> 00:02:32,550
just want to retrieve information. So one

61
00:02:32,550 --> 00:02:35,010
of the things that we can do in retrieving

62
00:02:35,010 --> 00:02:37,540
information is obviously use that same

63
00:02:37,540 --> 00:02:39,990
connection. So I'm going to do my computer

64
00:02:39,990 --> 00:02:43,480
variable again. Computer equals local

65
00:02:43,480 --> 00:02:46,240
host. And then we'll just reuse that one

66
00:02:46,240 --> 00:02:49,120
and then I can say, get W M I object.

67
00:02:49,120 --> 00:02:51,330
Samos. Before this time I'm gonna put

68
00:02:51,330 --> 00:02:52,700
computer name you notice doesn't really

69
00:02:52,700 --> 00:02:55,750
make a difference with the order. So I'm

70
00:02:55,750 --> 00:02:58,100
gonna say, Computer, I'm going to specify

71
00:02:58,100 --> 00:03:02,640
my class as I did before WinJS etoo

72
00:03:02,640 --> 00:03:05,270
operating system. And then look what I can

73
00:03:05,270 --> 00:03:08,490
do I can. Then pipe that value out to a

74
00:03:08,490 --> 00:03:11,290
select object and then I can say I'm going

75
00:03:11,290 --> 00:03:13,790
to get all the properties Star Press

76
00:03:13,790 --> 00:03:16,220
center Now, of course, that gives me a

77
00:03:16,220 --> 00:03:18,980
really unwieldy list of properties that I

78
00:03:18,980 --> 00:03:21,570
can actually access, which is great, But

79
00:03:21,570 --> 00:03:24,650
this format is just horrible. So how can

80
00:03:24,650 --> 00:03:27,080
we kind of change that well Let's do it a

81
00:03:27,080 --> 00:03:28,810
little bit differently. Let's create an

82
00:03:28,810 --> 00:03:31,200
object variable, and then what we'll do is

83
00:03:31,200 --> 00:03:33,560
we'll use the same command that we just

84
00:03:33,560 --> 00:03:36,220
ran. So get to be in my object computer

85
00:03:36,220 --> 00:03:39,690
name, dollar computer. And then we'll

86
00:03:39,690 --> 00:03:44,040
specify the class will do the wind 32

87
00:03:44,040 --> 00:03:46,820
operating system one again. Okay, so let's

88
00:03:46,820 --> 00:03:49,120
just check what our object has. And sure

89
00:03:49,120 --> 00:03:51,940
enough, it has the basic information. Now,

90
00:03:51,940 --> 00:03:54,420
what about if I wanted other information

91
00:03:54,420 --> 00:03:57,350
other than just these six values? Well,

92
00:03:57,350 --> 00:04:00,830
now that we have an object created I can

93
00:04:00,830 --> 00:04:04,240
pipe that object into something else so I

94
00:04:04,240 --> 00:04:08,090
could say select object and I could say

95
00:04:08,090 --> 00:04:10,790
Property star. Of course, that just gives

96
00:04:10,790 --> 00:04:12,750
me the same horrible list that I had

97
00:04:12,750 --> 00:04:15,150
before. So how could we make this a little

98
00:04:15,150 --> 00:04:17,270
bit better? So if we use the same thing

99
00:04:17,270 --> 00:04:22,690
again, I could then do select caption and

100
00:04:22,690 --> 00:04:26,050
then I start to get individual pieces. Or

101
00:04:26,050 --> 00:04:28,230
I could actually go all the way here,

102
00:04:28,230 --> 00:04:30,400
removal of the extra one and just do

103
00:04:30,400 --> 00:04:33,360
caption so we can select either individual

104
00:04:33,360 --> 00:04:36,450
values or multiple values. In fact, what I

105
00:04:36,450 --> 00:04:41,190
can do is I could say manufacturer and

106
00:04:41,190 --> 00:04:44,080
I can get to values come back. So making

107
00:04:44,080 --> 00:04:46,340
the connection to the other machine isn't

108
00:04:46,340 --> 00:04:48,470
just about connecting to it. It's about

109
00:04:48,470 --> 00:04:51,570
retrieving information that exists on that

110
00:04:51,570 --> 00:04:54,430
machine Now. The other thing that we can

111
00:04:54,430 --> 00:04:56,140
do here or that's actually quite

112
00:04:56,140 --> 00:05:00,070
important, is our ability to action to

113
00:05:00,070 --> 00:05:03,220
perform a task of some description. So

114
00:05:03,220 --> 00:05:06,970
let's say we wanted to retrieve a specific

115
00:05:06,970 --> 00:05:09,490
services. So we're gonna use that w my

116
00:05:09,490 --> 00:05:13,050
object again and we use the same computer

117
00:05:13,050 --> 00:05:16,420
name So dollar computer and this time will

118
00:05:16,420 --> 00:05:20,910
change the class to be win 32 and will

119
00:05:20,910 --> 00:05:23,210
change that to services on. What I'm then

120
00:05:23,210 --> 00:05:25,400
going to do is peg on the filter option

121
00:05:25,400 --> 00:05:28,000
here, and I'll do name equals. I'm using a

122
00:05:28,000 --> 00:05:32,080
key value pair here like so, and will use

123
00:05:32,080 --> 00:05:36,210
W u A U S R. V. So the Windows Update

124
00:05:36,210 --> 00:05:38,300
service. So I'm gonna click Enter here.

125
00:05:38,300 --> 00:05:40,090
This will then going query the remote

126
00:05:40,090 --> 00:05:43,890
machine for that specific service. And

127
00:05:43,890 --> 00:05:46,050
then I should be able to say service and

128
00:05:46,050 --> 00:05:47,800
sure enough, it comes back and it will say

129
00:05:47,800 --> 00:05:50,310
this is my process. IDE start mode is

130
00:05:50,310 --> 00:05:53,530
manual and it's running now, of course.

131
00:05:53,530 --> 00:05:56,250
What about if I wanted to start to start,

132
00:05:56,250 --> 00:05:59,050
restart, etcetera. That specific service.

133
00:05:59,050 --> 00:06:01,730
What? The good news is that this command

134
00:06:01,730 --> 00:06:05,330
returns a service object of that specific

135
00:06:05,330 --> 00:06:08,650
instance. So that means I can then say get

136
00:06:08,650 --> 00:06:12,030
member I can do type and then I can say,

137
00:06:12,030 --> 00:06:14,290
Get me the methods Now how fantastic is

138
00:06:14,290 --> 00:06:17,300
that it now lists. May all of the methods

139
00:06:17,300 --> 00:06:20,420
that are associate ID to that specific

140
00:06:20,420 --> 00:06:22,830
instance. So you'll see we have a start

141
00:06:22,830 --> 00:06:26,730
Onda stop. So if we wanted to stop a

142
00:06:26,730 --> 00:06:29,730
service, if I just clear this here we can

143
00:06:29,730 --> 00:06:32,900
say services, and then you'll see I have

144
00:06:32,900 --> 00:06:35,260
this stop service option and I can do

145
00:06:35,260 --> 00:06:38,990
that. Now it returns me some values. So

146
00:06:38,990 --> 00:06:41,260
let me check the status and do service a

147
00:06:41,260 --> 00:06:42,850
hold on a minute. It's still showing

148
00:06:42,850 --> 00:06:45,330
running. That's because the value that you

149
00:06:45,330 --> 00:06:47,670
have for the services from the previous

150
00:06:47,670 --> 00:06:50,380
call, So I now need to look back and say

151
00:06:50,380 --> 00:06:53,240
services. And then when I do, services

152
00:06:53,240 --> 00:06:55,170
will now say stopped. So you need to

153
00:06:55,170 --> 00:06:56,520
remember that when you're retrieving a

154
00:06:56,520 --> 00:06:58,500
service or trying to manage it, that the

155
00:06:58,500 --> 00:07:01,440
value that you have is the previous state

156
00:07:01,440 --> 00:07:04,620
that was there when you retrieved it. So

157
00:07:04,620 --> 00:07:07,020
let me go back to this way and do service

158
00:07:07,020 --> 00:07:11,730
Docker start services. Once again, I'm

159
00:07:11,730 --> 00:07:13,390
going to check my service. You should say

160
00:07:13,390 --> 00:07:15,870
stopped. Even though I've said to start,

161
00:07:15,870 --> 00:07:19,100
If I re initialize that service, it's now

162
00:07:19,100 --> 00:07:21,430
back to run in. So you can see the purpose

163
00:07:21,430 --> 00:07:23,960
of connecting two remote computer is to

164
00:07:23,960 --> 00:07:26,960
one make the connection to retrieve

165
00:07:26,960 --> 00:07:29,570
information and then, as an example, was

166
00:07:29,570 --> 00:07:33,000
to manage the services that reside on that machine.

