Foundations Level: Beginner Chapter 1: How Windows Works Underneath

Services and Service Accounts

Services are background processes that keep working without a user sitting at the screen, and each one runs under an account that limits what it can do.

Lesson 3 of 5 in Chapter 1: How Windows Works Underneath. Previous step in this path: Processes and Threads. 3 learning objectives, 4 examples, and a knowledge check.

Start: what you will learn

Services are background processes that keep working without a user sitting at the screen, and each one runs under an account that limits what it can do.

Learning objectives

  • Explain what a service is and why services exist
  • Tell LocalSystem, LocalService, and NetworkService apart in simple terms
  • Use Get-Service to check which services are running

Concept in simple words

What it is: A service is a special process that runs in the background, often starting when Windows starts, and it keeps working even when no user is logged on or sitting at the screen. A service account is the account that service runs as, and that account decides what the service is allowed to do. Least privilege is a simple rule, give a service only the power it truly needs, and no more.

Why it works

Why it works this way: Many jobs must happen without a person clicking anything, such as printing, updating, or sharing files on a network. Services exist for those jobs, because a normal app stops being useful when you log off. But a service with too much power is a risk, because if someone breaks into that service, they gain all of its power. So Windows gives services limited accounts by default, and only a few core services get the strongest account.

Think of it like this

Think of it like this: A service is like a night shift worker in a building. Nobody is watching them hour by hour, so you give them keys only to the rooms their job needs. LocalSystem is like giving someone the master key to the whole building, and you only do that when the job truly needs it. LocalService and NetworkService are like giving someone a key to one small room, which is safer if something goes wrong.

How it works, step by step

How it works, step by step: First, Windows starts its services during boot, in the background. Next, each service runs under its service account, and that account token sets its limits. LocalSystem has almost unlimited power on the local machine, and it presents the computer credentials on the network. LocalService has limited power on the local machine, and very limited power on the network. NetworkService also has limited power locally, but it can present the computer credentials on the network, which suits services that must talk to other machines without full local power. Managed accounts are accounts where Windows creates and rotates, which means regularly changes, the password for you, so you never have to set or remember a service password yourself.

Let us walk through an example: Imagine a print service. It needs to read print jobs on the local machine, and talk to a printer, but it does not need to change system settings or read every file. Giving it LocalSystem would be like giving the night worker the master key just to empty one bin. A limited account is the better fit, because if the print service is ever tricked, the damage stays limited to what that account can do.

When to use it

When to use it, and when not to: Use Get-Service to look at services, check their status, and learn their names before you change anything. Do not stop a service just to see what happens, because other services or apps may depend on it. Do not change a service to run as a powerful account to fix a permission error, because that hides the real problem and creates a bigger risk, instead find the smallest permission that makes the job work.

Start from zero: A normal app lives in your session, and it normally ends when you log off or close it. A service is different. It is owned by Windows itself, not by your desktop session, and the Service Control Manager, often shortened to SCM, starts it, tracks it, and can restart it. The SCM is the manager that knows every service, its state, its startup type, and its account. When Windows starts, the SCM starts the services that are meant to start at boot, even before you log on. That is why printing, updating, and networking jobs can be ready before you type a password.

Startup types, in plain words: Automatic means Windows tries to start the service during boot. Automatic Delayed means Windows starts it a short time after boot, so the desktop can come up first and the machine does not try to do everything at the exact same second. Manual means Windows does not start it at boot, but it can start later when something asks for it, or when you start it. Disabled means Windows will not start it, even if something asks for it, until you change that setting. A service set to Manual is not broken. It is simply waiting for a reason to start.

Service states, in plain words: Running means the service is up and doing its job. Stopped means it is not running right now, and that can be normal, for example when nothing needs it. Paused means it is still loaded but it has paused its work, and not every service supports pausing. Start Pending and Stop Pending are short transition states, which mean the service is in the middle of starting or stopping. Do not judge a service while it is pending, and do not try to change it again at once. Wait for it to settle into Running or Stopped, then decide.

Dependencies, in plain words: A service can depend on another service, which means it cannot do its job until the other service is running. If you stop a service that others depend on, Windows may stop those dependent services too, or it may warn you first. That is why stopping one service can break something that looks unrelated. The safe habit is simple. Before you stop anything, learn the service name, check what it does, and ask what else might need it. If you do not know, do not stop it just to test it.

Service accounts, in depth: LocalSystem is the strongest local account. It has almost unlimited power on the local machine, and it presents the computer credentials on the network. LocalService is a limited local account, with very limited network power, and it presents anonymous credentials on the network in the simple picture used here. NetworkService is also limited locally, but it presents the computer credentials on the network, so it suits a service that must talk to other machines without full local power. A normal user account can also run a service, but then the service depends on that user password, and it can break when the password changes.

Managed accounts, in depth: A managed service account is an account where Windows creates and rotates the password for you, so you never set it, and you never have to remember it. A group managed service account is the same idea for machines in a domain, where several machines can share the same managed account safely, and Windows still handles the password. The benefit is simple. No human knows the password, so no human can leak it, reuse it, or forget to change it. The service still gets a strong, regularly changed password, without the usual password chores.

Sessions, in plain words: Services run apart from your desktop session, in a separate session that is kept apart from user apps. That separation is deliberate. It means a service does not need a window, it does not need you to be logged on, and a crash in your desktop app does not take the service down with it. It also means a service cannot simply pop a window onto your screen to ask you a question. If a service needs input, it must use a proper channel, such as a log or a management tool, not a desktop popup.

Least privilege in practice, step by step: First, write down exactly what the service must do. Must it read one folder, write to one folder, talk to one printer, or talk to one other machine. Next, pick the weakest account that can do exactly that, and nothing more. Next, give that account permission on exactly the folders or resources it needs, and nowhere else. Last, test the service with that account, and fix only the one missing permission if it fails. If you instead upgrade the account to LocalSystem, you hide the real missing permission, and you give every future flaw in that service full local power.

A worked picture with BITS: BITS, the Background Intelligent Transfer Service, moves downloads in the background, in small pieces, so a large download does not block your work. When nothing is downloading, BITS is often Stopped, and that is normal, not a fault. When a download starts, Windows can start BITS, and it can stop again when the job is done. If you see BITS Stopped and you are not downloading anything, do not treat that as a problem to fix. The question is never just whether a service is running. The question is whether it is running when its job needs it, and stopped when its job does not need it.

Worked examples

Read each example in order. Each one explains its parts, then shows what to look for in the output.

Syntax

Syntax
Get-Service

Example 1

Get-Service asks Windows for the services on the machine. The pipe, written as |, passes those service objects to the next command. Select-Object keeps only the Name and Status properties, and -First 5 keeps only the first five results, so you get a short list to read.

Example 1
Get-Service | Select-Object Name, Status -First 5

Illustrative output: Name Status ---- ------ Spooler Running BITS Stopped Themes Running

Example 2

Get-Service asks Windows for the services on the machine. The -Name parameter narrows the result to one service, and Spooler is the name of the print service used here as an example. Without -Name, you would see all services instead of just this one.

Example 2
Get-Service -Name Spooler

Illustrative output: Status Name DisplayName ------ ---- ----------- Running Spooler Print Spooler

Example 3

Get-Service asks Windows for the services on the machine. Where-Object keeps only the objects that pass a test, and here the test is in braces. Inside the test, $_ means the current service, .Status reads its Status property, and -eq means equals, so only services with a Status of Running survive. The pipe, written as |, passes those service objects onward. Select-Object then keeps the Name and Status properties, and -First 5 keeps only the first five results. Look for Running in every row. If you change Running to Stopped, you get the opposite list, namely services that are not running right now, which is also useful, but it is a different question.

Example 3
Get-Service | Where-Object { $_.Status -eq "Running" } | Select-Object Name, Status -First 5

Illustrative output: Name Status ---- ------ Spooler Running Themes Running AudioSrv Running

Example 4

Get-Service asks Windows for the services on the machine. The -Name parameter narrows the result to one service, and BITS is the short name of the Background Intelligent Transfer Service used here as an example. The pipe, written as |, passes that service object to the next command. Select-Object then keeps the Name, Status, and DisplayName properties. Look for two different name columns. Name is the short name you use with -Name, and DisplayName is the friendly name you see in management tools. If you try to use the friendly name with -Name, the command will not find the service, because -Name expects the short name, not the friendly name.

Example 4
Get-Service -Name BITS | Select-Object Name, Status, DisplayName

Illustrative output: Name Status DisplayName ---- ------ ----------- BITS Stopped Background Intelligent Transfer Service

Nothing on this page executes PowerShell code. The outputs above are illustrative only.

Common mistakes and troubleshooting

Read these before you try the examples, so you can spot the same problems in your own work.

  • Stopping a service just to test it, without checking what depends on it, and then wondering why something else broke.
  • Giving every service the LocalSystem account to avoid permission errors, instead of finding the smallest account that works.
  • Thinking a stopped service means the program is uninstalled, when the service is only paused and the program files are still there.
  • Using the friendly DisplayName with the -Name parameter, when -Name expects the short Name, so the command finds nothing even though the service exists.
  • Thinking a Stopped service is always broken, when many services are meant to be Stopped until something needs them, such as BITS when nothing is downloading.
  • Giving a service account full control of a whole disk to fix one folder error, instead of giving it permission on only the one folder its job truly needs.

Knowledge check

Knowledge check

A service only needs to read local files and never needs to talk to other machines on the network. Which choice best fits least privilege?

Pick one answer. Feedback appears right away, and you can try again.

Remember this and next step

Remember this: Services are background processes, they exist so jobs keep running without a logged on user, each one runs under an account, LocalSystem is the most powerful, LocalService and NetworkService are limited, managed accounts let Windows handle the password, and least privilege means only the power that is truly needed.

Next step: Firmware and Partitioning