[Autogenerated] So let's go back into our
machine on. We'll look at how we execute
jobs locally on. Then we'll change to
executable remotely. Now, one of the
things that we want to be able to do
realistically is somehow manage the tasks
or the the kind of the PowerShell commands
that we wish to run now out of the box.
Unfortunately, there's no SIM methods for
starting jobs or task the such It's all
very much you write it out and off it goes
now. Luckily for us, we have a method
called start job, which isn't specifically
to do with the same commands, and it
requires a script block. A script block is
something that sits in those. Scroll your
brackets. Now the nice thing is, we can do
this we can combine the regular ones with
the seven Incidents ones or the SIM
commands, at least, so I'm going to say
get system Now. What this will do is a job
now executes, and you can see that the
start dash job is now running that job.
Now, of course, if I want to be able to
see how well that's done or if it's
completed, I can, we say receive job and I
actually wanted IDE there we do IDE on.
Then I'm going to say Job IDE one. And
sure enough, it retrieved my computer
information. You can see right here. It's
got my desktop name. It's a work group,
the total amount of RAM and the model
etcetera. So I was able to kick off a job,
but use the same instance inside of that
now we can do a little bit further with
this. So what we can do is I could
actually declare a job object, say start
job. It always requires a script block of
some description, and then I'm going to
say get same instance. I forgot to put em
same instance Here. I'm going to perform a
query and the query will be select Star
from We'll do the wind 30 to process Like
so where name like note had like So now
I'm just gonna launch no thead, obviously,
because I closed the last one. There's my
note pad, so there's my option and
going to close that. So this is going to
kick off a job that's gonna be dropped
into the job variable and retrieve the
information. So if I click on job here.
You'll see that my background job is IDE
of three. It executed and it's been
completed. Now we can use the receive. Let
me get this right. Receive Job Command to
be able to say the IDE of the job that I'm
looking for is job Dark IDE. And then,
sure enough, it returns the information
that I'm looking for. Okay, so what about
if we wanted to kind of tile this
together? So first off, what I'm gonna do
here is I'm going to populate a computer
variable local host or be it just the
local machine. And then what I want to be
able to do is execute a specific command
and then kind of have that run as a
specific job. Now, of course, in order to
do this, we need to kind of mix things
around a little bit. So we're going to mix
what would be regular PowerShell and Sim
kind of commands together. So what we
could do here is I could say, invoke
command, which is actually just a regular
PowerShell command. And then you can see
I've got a script block that I can
execute, then paste or utilize other
commands that I'm trying to get to. So
what I can do here? Say get same instance
here and I can say, Class name Win 32
computer system. So now I have my script
block. Then, at this point, I actually
have a computer name object that I can
pass into So I can say, computer. And then
there's also a parameter here called as
job. Now what that means is that I'm going
to call regular PowerShell asking for a
script block. The script block is going to
go and get me the instance off. Whatever
I've asked it for, which at this instance
will be the computer system details. And
I'm telling the command to be executed on
the computer as a job. So I've now
executed that it didn't run locally,
necessarily run it as a job. You could see
it's called a remote job and it's running
now. What I can do here is I can say go,
go and receive not that one. Go and
receive the job on the IDE for that is
gonna be seven. So I'm gonna do that. And
sure enough, it retrieved the information
so you can see we can kind of combine
things together and that's the power power
off. PowerShell have actually been able to
utilize SIM commands on regular PowerShell
commands, especially when it comes to executing things as jobs locally.