1
00:00:00,340 --> 00:00:01,430
[Autogenerated] So let's go back into our

2
00:00:01,430 --> 00:00:03,140
environment on. We'll look at how we

3
00:00:03,140 --> 00:00:09,110
execute commands using Sim. Okay, so now

4
00:00:09,110 --> 00:00:10,840
that we've looked at how the simple

5
00:00:10,840 --> 00:00:12,530
commands kind of work, or at least the

6
00:00:12,530 --> 00:00:15,260
common ones, how do we execute them? Well,

7
00:00:15,260 --> 00:00:17,110
first off, let's look at the get Sim

8
00:00:17,110 --> 00:00:19,350
instance which we know is going to allow

9
00:00:19,350 --> 00:00:22,070
us to pass a class name and then obviously

10
00:00:22,070 --> 00:00:25,030
retrieve values underneath. So if I just

11
00:00:25,030 --> 00:00:28,800
do class and then say Win 32 process, we

12
00:00:28,800 --> 00:00:31,910
ran this last time member. If I do that,

13
00:00:31,910 --> 00:00:34,440
it just lists me the processes. Now what

14
00:00:34,440 --> 00:00:36,970
we can do, I tell you what. Let me just

15
00:00:36,970 --> 00:00:39,960
clear this again is I can actually go one

16
00:00:39,960 --> 00:00:42,470
step further and I don't need to specify a

17
00:00:42,470 --> 00:00:46,200
class name or I can and pass a filter. So

18
00:00:46,200 --> 00:00:50,770
let's do name like and I'm going to do p

19
00:00:50,770 --> 00:00:54,600
percent and we'll do that now. Notice what

20
00:00:54,600 --> 00:00:58,290
happens. This then returns may just those

21
00:00:58,290 --> 00:01:01,690
items that match that P because we're

22
00:01:01,690 --> 00:01:03,990
doing a select statement effectively. But

23
00:01:03,990 --> 00:01:05,700
it's not a select statement. It's a

24
00:01:05,700 --> 00:01:08,150
filter. If I wanted to do a select

25
00:01:08,150 --> 00:01:10,510
statement, I wouldn't have to pass the

26
00:01:10,510 --> 00:01:12,780
class name. Either I could just say

27
00:01:12,780 --> 00:01:16,940
Queary, and then we're going to do select

28
00:01:16,940 --> 00:01:23,750
Star. Let me do a space here from win 32

29
00:01:23,750 --> 00:01:30,810
Process and And we do where name like, pay

30
00:01:30,810 --> 00:01:34,920
per cent. Like so the same thing again. So

31
00:01:34,920 --> 00:01:36,520
we have two different approaches. We can

32
00:01:36,520 --> 00:01:38,790
either pass the class name and filter or

33
00:01:38,790 --> 00:01:40,540
we can pass in a full query if we needed

34
00:01:40,540 --> 00:01:42,700
to. Now, of course, what we can do is

35
00:01:42,700 --> 00:01:45,700
Azure retrieving this we can also get the

36
00:01:45,700 --> 00:01:48,460
same instance that we're looking for so

37
00:01:48,460 --> 00:01:50,880
back to our class again. So we'll do win

38
00:01:50,880 --> 00:01:55,770
32 process and then I can use the property

39
00:01:55,770 --> 00:02:01,670
option to say, Get the name and kernel

40
00:02:01,670 --> 00:02:05,520
mode time and you enter now notice that

41
00:02:05,520 --> 00:02:08,250
just gives me so much information for

42
00:02:08,250 --> 00:02:11,170
every single process. Obviously, if ID

43
00:02:11,170 --> 00:02:12,680
filtered it because I could have added the

44
00:02:12,680 --> 00:02:13,720
filter to it, then it would have

45
00:02:13,720 --> 00:02:15,640
restricted that. So how do we make that

46
00:02:15,640 --> 00:02:16,920
look a little bit better? Well, let's

47
00:02:16,920 --> 00:02:18,980
repeat the same thing. But this time we're

48
00:02:18,980 --> 00:02:21,190
going to join that with regular commands

49
00:02:21,190 --> 00:02:23,700
and you'll see what we get now is a table.

50
00:02:23,700 --> 00:02:25,670
Now does it make it any easier? Not

51
00:02:25,670 --> 00:02:28,650
particularly just because it's kind of

52
00:02:28,650 --> 00:02:30,800
struggling to render the values backwards

53
00:02:30,800 --> 00:02:33,060
and forwards. But we can retrieve

54
00:02:33,060 --> 00:02:36,680
information by using standard commands. So

55
00:02:36,680 --> 00:02:38,450
let me just come into here and clear this

56
00:02:38,450 --> 00:02:41,910
so we have a clear screen now. What we can

57
00:02:41,910 --> 00:02:44,310
do as part of the getting instantiate

58
00:02:44,310 --> 00:02:46,780
Formacion is that we do have the ability

59
00:02:46,780 --> 00:02:49,230
to create new sessions now, as we talked

60
00:02:49,230 --> 00:02:51,040
about before, they get the same

61
00:02:51,040 --> 00:02:53,290
instantiate goes and just retrieves the

62
00:02:53,290 --> 00:02:56,760
value. So it doesn't really need me to say

63
00:02:56,760 --> 00:02:58,280
this is the computer that want to connect

64
00:02:58,280 --> 00:03:00,780
to. So what we can do is, if I just say

65
00:03:00,780 --> 00:03:04,230
new SIM session and press enter. It just

66
00:03:04,230 --> 00:03:05,770
creates a session, and it will

67
00:03:05,770 --> 00:03:08,720
automatically determine it's the local

68
00:03:08,720 --> 00:03:11,830
host and what it should be connecting to.

69
00:03:11,830 --> 00:03:13,990
Now what I can do is I can say, new SIM

70
00:03:13,990 --> 00:03:16,890
session computer. I'm going to say

71
00:03:16,890 --> 00:03:18,260
computer because I still have that from

72
00:03:18,260 --> 00:03:23,510
last time name and I'll call it trainer

73
00:03:23,510 --> 00:03:26,490
and do that know what I can do is then say

74
00:03:26,490 --> 00:03:30,040
get sim session and you'll see both the

75
00:03:30,040 --> 00:03:32,080
sessions then listed now notice the

76
00:03:32,080 --> 00:03:35,240
difference here. The default new SIM

77
00:03:35,240 --> 00:03:38,430
session will go ahead and use a specific

78
00:03:38,430 --> 00:03:40,550
protocol such as Deacon, your default to

79
00:03:40,550 --> 00:03:43,930
that. But if I specify the computer name,

80
00:03:43,930 --> 00:03:46,100
it then thinks it's a remote connection,

81
00:03:46,100 --> 00:03:48,000
even though it might be going to itself.

82
00:03:48,000 --> 00:03:51,190
But it then flicks it to use the WS man

83
00:03:51,190 --> 00:03:54,510
connection instead. Now, when we create in

84
00:03:54,510 --> 00:03:56,620
those connections, obviously one of the

85
00:03:56,620 --> 00:03:58,630
things that we might want to do. So let me

86
00:03:58,630 --> 00:04:02,230
just create a creds object. Here is NuGet.

87
00:04:02,230 --> 00:04:05,190
Credential is I might actually want to

88
00:04:05,190 --> 00:04:09,220
connect to a device a Windows machine

89
00:04:09,220 --> 00:04:11,510
using different credentials. So I'm gonna

90
00:04:11,510 --> 00:04:16,040
put trainer but the password in. And then

91
00:04:16,040 --> 00:04:17,620
what I should be able to do is go to

92
00:04:17,620 --> 00:04:19,470
Craigs and you should see that I have a

93
00:04:19,470 --> 00:04:22,260
credit object now. What that allows me to

94
00:04:22,260 --> 00:04:26,240
do is I can say, new SIM session computer

95
00:04:26,240 --> 00:04:30,490
name. I'm going to use computer now. I can

96
00:04:30,490 --> 00:04:33,040
specify a credential object, which I have

97
00:04:33,040 --> 00:04:35,910
so creds and then I can specify an

98
00:04:35,910 --> 00:04:39,670
authentication mode such as negotiate

99
00:04:39,670 --> 00:04:41,640
notice. That then creates me a third

100
00:04:41,640 --> 00:04:45,820
session. So let me just do get sim

101
00:04:45,820 --> 00:04:48,900
session. I know have three. I have one d

102
00:04:48,900 --> 00:04:51,070
com, which is the default and then two

103
00:04:51,070 --> 00:04:53,210
sessions notice. The third session doesn't

104
00:04:53,210 --> 00:04:54,760
have a name because I didn't specify the

105
00:04:54,760 --> 00:04:57,510
name, but they are remote sessions. One of

106
00:04:57,510 --> 00:05:00,400
them automatically used credentials here.

107
00:05:00,400 --> 00:05:02,860
One of them used credentials that I had

108
00:05:02,860 --> 00:05:05,510
passed. So that allows me to create and

109
00:05:05,510 --> 00:05:08,150
create sessions to the machine. Now, once

110
00:05:08,150 --> 00:05:11,520
we have the session connected in whichever

111
00:05:11,520 --> 00:05:13,820
format, then the ability we have is to

112
00:05:13,820 --> 00:05:18,110
invoke a specific method. So I can invoke

113
00:05:18,110 --> 00:05:20,850
a SIM method. Now, think about this. When

114
00:05:20,850 --> 00:05:24,140
we do retrieving of the wind 32 processes

115
00:05:24,140 --> 00:05:26,370
we can, then do get member and retrieve

116
00:05:26,370 --> 00:05:28,800
the list of kind of methods that are

117
00:05:28,800 --> 00:05:30,700
available, which we did using the W my

118
00:05:30,700 --> 00:05:33,560
commands. Now, what we could do here is

119
00:05:33,560 --> 00:05:36,260
using the invoke SIM method is once we

120
00:05:36,260 --> 00:05:39,540
know what they are, I'm then able to

121
00:05:39,540 --> 00:05:42,600
terminate start to create etcetera. So I'm

122
00:05:42,600 --> 00:05:44,960
going to click here and just type note pad

123
00:05:44,960 --> 00:05:47,440
and just launch an instance of note pad.

124
00:05:47,440 --> 00:05:49,270
So let me just make this a little bit

125
00:05:49,270 --> 00:05:52,240
smaller. So here's my note pad window. I'm

126
00:05:52,240 --> 00:05:54,540
gonna minimize it. But you can see here

127
00:05:54,540 --> 00:05:57,380
I'm going to say invoke method. What I'm

128
00:05:57,380 --> 00:06:01,940
then going to do is query that and say,

129
00:06:01,940 --> 00:06:07,770
Select star from Win 32 process, remember?

130
00:06:07,770 --> 00:06:09,520
Oh, I need to move that space. They would

131
00:06:09,520 --> 00:06:16,940
go win 32. Process where? Name like And

132
00:06:16,940 --> 00:06:20,260
then, of course, as we did before. Like

133
00:06:20,260 --> 00:06:22,880
so. So what we end up with is something

134
00:06:22,880 --> 00:06:25,130
that looks like this. Now, I need to put

135
00:06:25,130 --> 00:06:27,050
different quotes around that one. So let

136
00:06:27,050 --> 00:06:32,780
me do this. Okay? Note pad. Then what

137
00:06:32,780 --> 00:06:35,930
I can do is pass a method name which I

138
00:06:35,930 --> 00:06:38,620
know happens to be called Terminate. So

139
00:06:38,620 --> 00:06:40,240
I'm gonna press enter, and that's what

140
00:06:40,240 --> 00:06:42,050
happened. It was really fast. You might

141
00:06:42,050 --> 00:06:43,750
have seen it, but it disappeared from the

142
00:06:43,750 --> 00:06:47,740
bottom. It vanished. So we lost that

143
00:06:47,740 --> 00:06:50,250
instance of the application. So the invoke

144
00:06:50,250 --> 00:06:54,190
method lets me not only Queary locally

145
00:06:54,190 --> 00:06:55,450
because obviously that's the machine that

146
00:06:55,450 --> 00:06:57,690
I'm executing it on. But it also lets me

147
00:06:57,690 --> 00:06:59,860
run specific methods. Now, let's go a

148
00:06:59,860 --> 00:07:03,370
little bit further. What about if I wanted

149
00:07:03,370 --> 00:07:05,790
to go one step further on this time? I'm

150
00:07:05,790 --> 00:07:07,590
not gonna write a query, because remember,

151
00:07:07,590 --> 00:07:11,340
we can still use class name, So when 32

152
00:07:11,340 --> 00:07:16,480
process, I'm gonna say ____ method name

153
00:07:16,480 --> 00:07:18,660
this time I wanna be clever and I want to

154
00:07:18,660 --> 00:07:22,900
create an instance. Now I have the ability

155
00:07:22,900 --> 00:07:25,280
to pass arguments to this and the

156
00:07:25,280 --> 00:07:28,470
arguments are past inside this. So we do

157
00:07:28,470 --> 00:07:30,220
an at sign with the scroll do brackets to

158
00:07:30,220 --> 00:07:34,740
be able to pass a kind of key value pair.

159
00:07:34,740 --> 00:07:40,390
So I'm going to say no pad xy and that

160
00:07:40,390 --> 00:07:43,760
should be enough. I'm gonna press enter No

161
00:07:43,760 --> 00:07:45,610
notice. What happened? My note pad came

162
00:07:45,610 --> 00:07:48,000
back. I now have a new instance of that

163
00:07:48,000 --> 00:07:50,140
note pad. And of course, if I wanted to

164
00:07:50,140 --> 00:07:52,080
I can go back and terminate. So what's

165
00:07:52,080 --> 00:07:54,620
great here is that as we're building

166
00:07:54,620 --> 00:07:57,170
commands to do things if we need to spawn

167
00:07:57,170 --> 00:07:59,720
off other processes or close existing

168
00:07:59,720 --> 00:08:01,570
processes, so think of the idea of

169
00:08:01,570 --> 00:08:03,880
patching something or making an update to

170
00:08:03,880 --> 00:08:06,090
a specific service or server on that

171
00:08:06,090 --> 00:08:07,980
machine. You can simply go through and

172
00:08:07,980 --> 00:08:11,160
say, Start, stop or execute or launch new

173
00:08:11,160 --> 00:08:13,520
processes as needed. So these are kind of

174
00:08:13,520 --> 00:08:16,270
the common commands that you would execute

175
00:08:16,270 --> 00:08:23,000
on run within those remote machines using base sim commands

