[Autogenerated] So let's go back into my
windows 10. Machine on. Well, first, look
at how we connect to remote computers
using W m I. More then retrieve
information from that remote computer on.
Then we'll look at how we can manage the
services on that computer. Okay, so we're
back on the machine now. And of course,
what we want to do here is we actually
want to look at how we can connect to a
different machine using the W my commands.
Now, of course, you can see I've got to
PowerShell tabs open. One is PowerShell
seven on one is regular PowerShell. In
order to use the GitHub, my you'll need to
be used in the regular windows PowerShell.
So if I want to make a connection, then of
course, we need to use GitHub my object.
And then we specify the class that we wish
to use. So I'm going to say operating
system is my class. And then to make it a
remote connection, we simply use local
host for the computer name. And then, of
course, that now connects me. Now, of
course, it's not too remote, one per se,
because I'm connecting to the device that
I'm on. So what about if we wanted to pass
available to that instead, so I could do
computer equals local host. So there's my
variable I can. Then use the same
commanders before and this time we move
that and use computer, and sure enough, it
gets me the same value back. So creating a
connection to a computer is a simple is
using the computer name property on, then
using the computer name? Now, of course,
you can't just randomly connect to any
machine. You'll need to have some kind of
firewall openings on the service
themselves to allow remote connection to
that server. Now, of course, that's a
specific task that would need to be ran
Now, of course, what we can do is when we
initially create our connection, we do
have the ability to pass other parameters
so you'll see here. There's an
impersonation. Once I'm going to set that
to three impersonation means I want to
pass credentials across to it, I can, then
say credential. And whatever the domain
user credentials are I can, then pass that
now There's no point trying this on a
local host. The local host doesn't
actually work that way, so it will
actually fail if we try to do it. So I was
gonna do this one here and clear it. Now,
of course, one of the things that's
interesting is, of course, when we make a
connection to remote machine, we really
just want to retrieve information. So one
of the things that we can do in retrieving
information is obviously use that same
connection. So I'm going to do my computer
variable again. Computer equals local
host. And then we'll just reuse that one
and then I can say, get W M I object.
Samos. Before this time I'm gonna put
computer name you notice doesn't really
make a difference with the order. So I'm
gonna say, Computer, I'm going to specify
my class as I did before WinJS etoo
operating system. And then look what I can
do I can. Then pipe that value out to a
select object and then I can say I'm going
to get all the properties Star Press
center Now, of course, that gives me a
really unwieldy list of properties that I
can actually access, which is great, But
this format is just horrible. So how can
we kind of change that well Let's do it a
little bit differently. Let's create an
object variable, and then what we'll do is
we'll use the same command that we just
ran. So get to be in my object computer
name, dollar computer. And then we'll
specify the class will do the wind 32
operating system one again. Okay, so let's
just check what our object has. And sure
enough, it has the basic information. Now,
what about if I wanted other information
other than just these six values? Well,
now that we have an object created I can
pipe that object into something else so I
could say select object and I could say
Property star. Of course, that just gives
me the same horrible list that I had
before. So how could we make this a little
bit better? So if we use the same thing
again, I could then do select caption and
then I start to get individual pieces. Or
I could actually go all the way here,
removal of the extra one and just do
caption so we can select either individual
values or multiple values. In fact, what I
can do is I could say manufacturer and
I can get to values come back. So making
the connection to the other machine isn't
just about connecting to it. It's about
retrieving information that exists on that
machine Now. The other thing that we can
do here or that's actually quite
important, is our ability to action to
perform a task of some description. So
let's say we wanted to retrieve a specific
services. So we're gonna use that w my
object again and we use the same computer
name So dollar computer and this time will
change the class to be win 32 and will
change that to services on. What I'm then
going to do is peg on the filter option
here, and I'll do name equals. I'm using a
key value pair here like so, and will use
W u A U S R. V. So the Windows Update
service. So I'm gonna click Enter here.
This will then going query the remote
machine for that specific service. And
then I should be able to say service and
sure enough, it comes back and it will say
this is my process. IDE start mode is
manual and it's running now, of course.
What about if I wanted to start to start,
restart, etcetera. That specific service.
What? The good news is that this command
returns a service object of that specific
instance. So that means I can then say get
member I can do type and then I can say,
Get me the methods Now how fantastic is
that it now lists. May all of the methods
that are associate ID to that specific
instance. So you'll see we have a start
Onda stop. So if we wanted to stop a
service, if I just clear this here we can
say services, and then you'll see I have
this stop service option and I can do
that. Now it returns me some values. So
let me check the status and do service a
hold on a minute. It's still showing
running. That's because the value that you
have for the services from the previous
call, So I now need to look back and say
services. And then when I do, services
will now say stopped. So you need to
remember that when you're retrieving a
service or trying to manage it, that the
value that you have is the previous state
that was there when you retrieved it. So
let me go back to this way and do service
Docker start services. Once again, I'm
going to check my service. You should say
stopped. Even though I've said to start,
If I re initialize that service, it's now
back to run in. So you can see the purpose
of connecting two remote computer is to
one make the connection to retrieve
information and then, as an example, was
to manage the services that reside on that machine.