[Autogenerated] So let's go back into our
environment on. We'll look at how we
execute commands using Sim. Okay, so now
that we've looked at how the simple
commands kind of work, or at least the
common ones, how do we execute them? Well,
first off, let's look at the get Sim
instance which we know is going to allow
us to pass a class name and then obviously
retrieve values underneath. So if I just
do class and then say Win 32 process, we
ran this last time member. If I do that,
it just lists me the processes. Now what
we can do, I tell you what. Let me just
clear this again is I can actually go one
step further and I don't need to specify a
class name or I can and pass a filter. So
let's do name like and I'm going to do p
percent and we'll do that now. Notice what
happens. This then returns may just those
items that match that P because we're
doing a select statement effectively. But
it's not a select statement. It's a
filter. If I wanted to do a select
statement, I wouldn't have to pass the
class name. Either I could just say
Queary, and then we're going to do select
Star. Let me do a space here from win 32
Process and And we do where name like, pay
per cent. Like so the same thing again. So
we have two different approaches. We can
either pass the class name and filter or
we can pass in a full query if we needed
to. Now, of course, what we can do is
Azure retrieving this we can also get the
same instance that we're looking for so
back to our class again. So we'll do win
32 process and then I can use the property
option to say, Get the name and kernel
mode time and you enter now notice that
just gives me so much information for
every single process. Obviously, if ID
filtered it because I could have added the
filter to it, then it would have
restricted that. So how do we make that
look a little bit better? Well, let's
repeat the same thing. But this time we're
going to join that with regular commands
and you'll see what we get now is a table.
Now does it make it any easier? Not
particularly just because it's kind of
struggling to render the values backwards
and forwards. But we can retrieve
information by using standard commands. So
let me just come into here and clear this
so we have a clear screen now. What we can
do as part of the getting instantiate
Formacion is that we do have the ability
to create new sessions now, as we talked
about before, they get the same
instantiate goes and just retrieves the
value. So it doesn't really need me to say
this is the computer that want to connect
to. So what we can do is, if I just say
new SIM session and press enter. It just
creates a session, and it will
automatically determine it's the local
host and what it should be connecting to.
Now what I can do is I can say, new SIM
session computer. I'm going to say
computer because I still have that from
last time name and I'll call it trainer
and do that know what I can do is then say
get sim session and you'll see both the
sessions then listed now notice the
difference here. The default new SIM
session will go ahead and use a specific
protocol such as Deacon, your default to
that. But if I specify the computer name,
it then thinks it's a remote connection,
even though it might be going to itself.
But it then flicks it to use the WS man
connection instead. Now, when we create in
those connections, obviously one of the
things that we might want to do. So let me
just create a creds object. Here is NuGet.
Credential is I might actually want to
connect to a device a Windows machine
using different credentials. So I'm gonna
put trainer but the password in. And then
what I should be able to do is go to
Craigs and you should see that I have a
credit object now. What that allows me to
do is I can say, new SIM session computer
name. I'm going to use computer now. I can
specify a credential object, which I have
so creds and then I can specify an
authentication mode such as negotiate
notice. That then creates me a third
session. So let me just do get sim
session. I know have three. I have one d
com, which is the default and then two
sessions notice. The third session doesn't
have a name because I didn't specify the
name, but they are remote sessions. One of
them automatically used credentials here.
One of them used credentials that I had
passed. So that allows me to create and
create sessions to the machine. Now, once
we have the session connected in whichever
format, then the ability we have is to
invoke a specific method. So I can invoke
a SIM method. Now, think about this. When
we do retrieving of the wind 32 processes
we can, then do get member and retrieve
the list of kind of methods that are
available, which we did using the W my
commands. Now, what we could do here is
using the invoke SIM method is once we
know what they are, I'm then able to
terminate start to create etcetera. So I'm
going to click here and just type note pad
and just launch an instance of note pad.
So let me just make this a little bit
smaller. So here's my note pad window. I'm
gonna minimize it. But you can see here
I'm going to say invoke method. What I'm
then going to do is query that and say,
Select star from Win 32 process, remember?
Oh, I need to move that space. They would
go win 32. Process where? Name like And
then, of course, as we did before. Like
so. So what we end up with is something
that looks like this. Now, I need to put
different quotes around that one. So let
me do this. Okay? Note pad. Then what
I can do is pass a method name which I
know happens to be called Terminate. So
I'm gonna press enter, and that's what
happened. It was really fast. You might
have seen it, but it disappeared from the
bottom. It vanished. So we lost that
instance of the application. So the invoke
method lets me not only Queary locally
because obviously that's the machine that
I'm executing it on. But it also lets me
run specific methods. Now, let's go a
little bit further. What about if I wanted
to go one step further on this time? I'm
not gonna write a query, because remember,
we can still use class name, So when 32
process, I'm gonna say ____ method name
this time I wanna be clever and I want to
create an instance. Now I have the ability
to pass arguments to this and the
arguments are past inside this. So we do
an at sign with the scroll do brackets to
be able to pass a kind of key value pair.
So I'm going to say no pad xy and that
should be enough. I'm gonna press enter No
notice. What happened? My note pad came
back. I now have a new instance of that
note pad. And of course, if I wanted to
I can go back and terminate. So what's
great here is that as we're building
commands to do things if we need to spawn
off other processes or close existing
processes, so think of the idea of
patching something or making an update to
a specific service or server on that
machine. You can simply go through and
say, Start, stop or execute or launch new
processes as needed. So these are kind of
the common commands that you would execute
on run within those remote machines using base sim commands