Windows Services are critical software carefully designed to provide functionality to applications, network services, and the operating system. Newer versions of Windows 10 bring significant changes to services! An overview of dependencies and their complex nature. A look at startup types and recovery options for services. Can I turn any application into a service? A review of some services on Windows 11. Troubleshooting services using event viewer and utilities to restore missing or corrupted *.dll files that might impact a service.
Hello, my name is Lowell Vanderpool and this channel is dedicated to IT students,
IT professionals, and anyone who enjoys learning technical subjects.
Our presentation and demonstration today is going to be covering Windows Services.
We're going to look at Windows 11 and Server 2022 and we're going to look at this diverse
set of modular software that sits on top of the kernel. It provides this very broad set of
functions to applications, to network, to just about everything that we need our operating
system to do. Now in Windows Server 2008 R2 and Windows 7, Microsoft introduced the managed
service accounts. These are new ways of giving accounts to services. One was MSA and the other
one's virtual service account. One, they removed the need for password resets and two, they gave
more granular control over these accounts that run on services. In Server 2016, Microsoft
introduced the GMSA or group managed service accounts. This just gave more control, more
fine-tuning of privileges for those managed accounts. A lot of server applications need
services to run with the application. These accounts to run that service are critical.
Applications like Exchange, SQL, web servers, and containers all need special accounts so that they
can run. Now in the days of Windows 7 and as we began to move into Windows 10, it was often you
would see an svchost.exe service and you would explore it and find out there were many, many
services running under one svchost executable. Now svchost is known as a service host. It's a
system process that can hold one or more Windows services running in that process. svchost.exe is
a shared service process that serves as a shell for loading services from DLL files. Back to
Process Explorer and we'll look at our services again. Here's an svchost and notice I have a lot
of them. So how does the svchost using the same executable launch so many different kinds of
services and the secret sauce is in the command line. So I'm going to choose this one, right mouse
click, go to properties. We're using the svchost.exe from the system32 folder but look at this command
line. That's what's actually determining what service has launched that command line. Mark has
also created a mouseover feature so that you can mouse over any particular svchost and you can
actually see it pop up and show you the command line and any specific registry settings that need
to be implemented with that svchost and its associated service are also shown in that
mouseover. You can see it by going clicking it and going back into properties but it saves you having
to do that. You can just hover over each svchost and you see basically the kinds of things you want
Remember in part one of this lecture I told you that services are launched in a different session
than the user applications and user software. So let's take a look at that. I'm going to go up to
columns. I'm going to right mouse click and select columns and under process image I'm going to choose
the option of sessions and it's going to put the session column all the way over here to the far
right and I'm going to click it and drag it over and so now we can see the sessions that these
services have been launched under and we see a bunch of them launched under session zero. So
these were launched early in the boot process. Every service is not always launched in session
zero. Here I have a svchost and it's actually launched in the same session as myself the logged
Keep in mind that every service isn't in session zero. Microsoft selects services deliberately to
isolate them from the user. Also we want to note that not every service is an svchost. Right above
I've got this nisserv.exe. This is a service. I can always tell that in process explorer by going to
properties and I will always have a service tab. This service tab indicates that this is a service.
So if you're not sure always right mouse click go to properties in process explorer you should
have a service tab. Again another point to make about how critical they are. If you notice under
services.exe it launches an svchost and underneath that is all the frameworks and runtime brokers
that make up the windows store apps. Now I hope you picked up on what I just said in the last
few slides is that bottom line services are simply DLLs. DLLs can't execute themselves
so they create a generic process svchost.exe so that they can be executed. The bottom line
services are just DLLs. Now it was often the case you could come over and take process explorer and
mouse over any svchost and you would see a long list of services that were in one single svchost.
But recently the recent additions of windows 10 microsoft has made a big change. If you have
3.5 gigabytes of ram or more on your pc laptop or client you now every single service gets its own
svchost.exe. So microsoft's reason for doing that were many fold. Number one increased reliability
because they're isolating one service from another. Two supposedly reducing support costs
because before you would have to then figure out a way of isolating these services running
in the same svchost from each other causing more difficulty in troubleshooting. Increasing security
because you're isolating and scalability. So these are some of the reasons why microsoft is moving to
every service in its own svchost.exe. Both on the client side and the server we run both 32-bit
services and 64-bit services. Now keep in mind we don't always use an svchost.exe executable to run
a service but if you do and it's a 64-bit service that svchost.exe will come out of the system32
folder. If it's a 32-bit service that same executable will come out of the syswow64
folder. No administrator can talk about windows services without also talking about the registry.
Services are pretty easy to find in the registry. HKEYLOCALMACHINE, SYSTEM, CURRENTCONTROLSET,
SERVICES and all of the registry controls for those services are found there. If you're working
on the client make sure you do a restore point before you start modifying registry settings
related to services. If you're a windows server you can export any registry key so that you can
have a backup should you need to restore that key. Let's take a look at the graphic on the right and
you can see we're looking at ip helper service and i've chosen the dependency tab and you can
begin to see where it says this service depends on the following system components and it has a list
network store interface service rpc tcp ip protocol driver and on and on and on you can see
these lists of services that ip helper depends on them functioning properly before it can function
properly and then below that is another it says the following system components depend on ip helper
and it lists network connectivity assistant you can see this is very complex the interdependence
of one service to another service now i've taken that first dialog box and broken it down i've
kind of opened it all up and you can see this is quite complex all of these services need to
function correctly in order for ip helper service to function correctly now when that gets into
troubleshooting any one of these could cause ip helper to not work properly or become unstable
or to hang or to not start it is much more complex to troubleshoot these than what you
might think this is a diagram showing kind of a breakdown of interdependence of services on a
single host now this gets more interesting what if i have access running on a client and it's
talking to an sql database running on a server or running on a host server and then i have a database
on a back end so i've got three hosts involved with one application you can have this network
services interdependencies because it's a network client server application now microsoft has a
number of ways to start services and you see in my dialog box i've pulled down the start type so you
see automatic delayed start that was really to help windows peer to boot a little bit better
automatic manual and disable these are all options for the administrator to decide how
to start services now trigger start is a feature that allows an event to trigger a service on just
as we have the options to start a service the recovery tab gives you many many options on what
to do when a service is not working correctly you have first failure second failure subsequent
failures it's automatically handling a service failure each of these options gives you things
like take no action just stop don't do anything restart the service run a program restart the
computer so there's lots of options here when a service fails what you can do in automating the
response of the operating system to this failure of the service many server applications give you
best practices for those recovery settings some of them even provide scripts that you can run upon
a service failure if you want to monitor your services especially on a server github has many
powershell scripts that are available for free that help you monitor your services and notify
you if a service restarts or stops etc and it can even send you email you can also use task manager
to automate how often these scripts run on any schedule mr vanderpool can i take any application
and turn it into a windows service well yes and no so there are third-party applications that allow
you to take a normal user application and turn it into a windows service but there's a couple of
things you need to think about one you'll have to manually update this application number two make
sure that the application is not already automatically running after logon prior to
setting up this application as a service or you could wind up with two instances of that application
running number three you will not have an interface to this application once it becomes a service now
if you'll notice up to this point i really haven't talked about any specific service i've talked all
around them all about its features and security and everything but the services themselves so
let's take a few minutes and dive into some really important services that i want to highlight and
make sure you're aware of what they are and what they do honestly you need to get into the services
gui and read the descriptions i've got a column here you can stretch it out and you can just
read the description of each and every service it's a great way to learn what's in your operating
system so my first service that i want to talk about is called bits background intelligence
transfer service this is amazing it's a tool that was added i think in windows 7 maybe in vista and
it takes the updates no matter how large they are and just sips them down from the update server so
that you can pull down a huge file and never even know it it doesn't seem to impact your network it
doesn't seem to impact your workstation because that's its job is to transfer files from microsoft
update so that you don't ever know they're coming down and they don't really seem to impact when
this fails it impacts microsoft update so this is one that can be one you have to play with i forgot
that i did mention the clipboard service if you've got administrative workers who are heavy into
microsoft word especially law firms or administrative assistants where they use a lot
of applications dealing with documents clipboard service is going to be one of your headaches
because when it goes south trust me there's no rest for your soul the other one is dhcp client
without it you can't pull an ip address so this can impact you pulling an ip address so don't rule
this out remember you have a service that's actually pulling ip address from your dhcp server
another important one dns client this is your dns resolver locally if you have problems with this
client you're going to have issues you can actually interact with this service by doing the ip config
forward slash flush dns and it flushes out the dns caching another very important one is group
policy client remember as you're in an enterprise and you're pushing group policies down from your
domain controller a lot of times you can have problems with that and one thing you want to do
is just restart this service you can't be in the enterprise at any length of time especially in the
help desk that you don't come to know and hate this service prince spooler so if you have a corrupted
file boom this dies i'm always amazed how many texts that i bump into that don't understand
server service you with this service on you can share folders files and printers to the network
if i disable that service you can't do anything on the network you can't share a folder share a file
in fact you just disappear from the network another service that i'm always amazed that
people that i bump into don't have a clue what it is and that's the workstation service this allows
you to look on the network and see servers if i disable that you can't see anything on the network
you are blind now i just picked a few because i don't want you sitting in front of a screen for
hours listening to me ramble but get in there and learn some of these great services that microsoft
puts on your workstation so as we look at troubleshooting services always think about
starting with third-party services first before you start looking at microsoft services now as
we begin to troubleshoot services we're going to start with event viewer because that will at least
help us to start to dig down to possibly discover what our problem is here i'm in windows 11 which
is very similar to server it's slightly different i'm going to go to my windows start square i guess
you could call it and launch event viewer now i want to filter out events that are based on what
happens to service control manager because any event failure or problem is going to be reflected
in the service control manager i could start with windows logs go to system and i could then filter
those logs i would say critical warning error and i want to filter based on event source called
system control manager and i just slide down there and find this rascal so i'm going to check that
box and say okay and now i can actually and now i'm going to look at all the log files or events
that happened in the windows system log that had related to the system control manager now if this
was exchange service or an application service then i would do the same thing i'd go under
application event logs and i would find the event the application event log and i would filter the
same way that's a good place to start we all know that events ids and event descriptions are not
always helpful but it's at least a good place to begin many different type failures in services
require looking for a variety of event ids for problems for example you could have an authentication
failure that causes a server to fail to start you got to look at a whole different type of event id
for that services can cause unexpected reboots so you would look at say event id 41 services can
cause application hangs or faults so you'd look at event ids 1002 or 1000 services can time out so
you would look at event id 7009 now i wish i could tell you that i could give you this magical list
of event ids and your problems would be solved it's never that simple it takes years of experience
doing administration working with applications troubleshooting all of that combined gives you a
basic understanding of how to troubleshoot these applications they'll all be slightly different
often services fail due to missing dll files or corrupted dll files if you feel like you
have a service that's failing due to corrupted dlls or missing dlls you can always use the
dism.exe with these arguments and switches to go to update and pull down any missing files that you
may have also sfc forward slash scan now can help you recover missing or corrupted files you can
also perform this in safe mode if necessary sfc will give you a log file called cbs.log
and you can review it to see what did it fix you must run your command prompt and elevated
credentials and you can see i'm running dism on my system right now here was where i ran sfc
forward slash scan now again elevated credentials on your command prompt and you can see that it
actually did find a corrupted file and repaired it i went and looked at my log my cbs.log file
and i was able to determine it was a dot net framework file here is where i turned my log
file into a text file and i can actually see what it actually did and of course if you're on a
windows server you feel like you have corrupted or missing files you can always go to restore your
server from known good backups don't forget our video notes you can download from the video
description on youtube also you can down the slide deck it's a great way to review everything
you just heard it helps you retain this information