Now though it's useful to be able to look at the running processes,
another option is to actually use what's called Get‑Service,
which is the same as launching the service's MSE console or the snap in,
to see the services that are running.
So, of course, I just did Get‑Service,
and it lists me all of the services that are executed and running.
If we wanted to target a specific service,
then, of course, we do have the ability to type in a specific service,
for example, and if the service is correct,
which this one isn't correct because I've missed a letter,
if I go here, then it will find the Security Center service as Running.
We can also do the same thing for using multiple services as
well by simply using the comma and then typing in the next
service that we wish to use, like so.
So I've now got the Bluetooth service and the security service,
and I could format them in the list and do all kinds of different things.
Now, retrieving the processes is very much,
let me just clear this here so we're back here,
retrieving the service, so, for example,
that service we were utilizing is exactly the same as using the Get process,
and we also have access to various properties or attributes that are available.
So, DisplayName, for example,
or I could go through and say show me the required
services that are needed to make that work.
We can also combine all those together and say get me all of
the services where the required services or dependent
services have various properties, and then,
you know, go through and format that table out.
Now, if we wanted to perform that same process on a remote machine,
remember, if we go back to our session, we do have a session that's there,
so I can say Enter‑PSSession, and I'm going to go into my existing sessions,
that takes me back to my Windows Server,
and then from here, I can say Get‑Service,
and this will do the same thing that we did before.
So let me just clear this out here.
If I wanted to target a specific service, the same commands work perfectly fine.
So I can say, wscsvc, and it brings back,
obviously I need to put them in quotes,
and you'll notice that on this specific service,
that service isn't executing on that machine.
And that's okay.
If we go back and type in a different service,
so bthserve, you'll see the Bluetooth support service is,
but the other service isn't.
So,
we can utilize all of the same commands to be able to
retrieve service information as needed.
So DisplayName, obviously on that server,
if we just actually Tab, for example,
you've got these kind of options where you can see whether
it's available for you to start and stop.
I can then go through and look at the required services,
the service name, what is dependent on the startup type,
what the current status is, and this one says,
well it's stopped,
which leads us into what we can do is we do have
the ability to control services.
Now,
processes obviously are either created by a service that's running
or there's something else that's executing it,
and you can kind of stop and start those a little bit,
but you basically kill them.
But for services,
we do have the ability to just go in and start and stop and restart.
So, for example, I could say Start‑Service,
and the name for this one, we'll use the one that we've been using,
so bthscrv, like so.
So now that's going to give me the service and you'll see it's now running.
If I now go back over here and say Stop‑Service,
we should get our status and it'll say stopped.
So not only are we able to inspect the services,
but we are also able to start and stop the services
and have some elements of control.
And that's as simple as it is to retrieve them either
locally or within an existing session.
I'm going to just exit my PSSession now,
and that takes me back to this machine, which is my client.