Windows background services represent the backbone of the Windows 11 operating system. From network resolution and hardware drivers to antivirus protection and database servers, background services handle low-level system operations without requiring user interaction. While the graphical Services management console (services.msc) is standard for casual inspection, IT administrators, developers, and power users require the speed, precision, and automation capabilities of PowerShell.
The native PowerShell cmdlets Get-Service and Set-Service provide a modern, object-oriented framework for controlling background tasks. Unlike legacy command-line tools like sc.exe or net start, PowerShell cmdlets return structured objects that can be piped, filtered, queried across remote machines, and scripted seamlessly. In this guide, you will master querying service status, starting and stopping processes, configuring startup types, and resolving stuck services using PowerShell in Windows 11.
Launching PowerShell with Elevated Administrative Privileges
While querying services can be done from a standard user terminal, starting, stopping, or altering service startup types requires elevated privileges:
- Right-click the Start button on the taskbar (or press Windows + X).
- Select Terminal (Admin) or PowerShell (Admin).
- Click Yes at the User Account Control (UAC) prompt to open an elevated administrative console.
How to Query Services Using Get-Service
The Get-Service cmdlet retrieves details about services installed on the local system.
1. Listing All Installed Services
Get-Service
This command outputs a table displaying Status (Running, Stopped), Service Name, and Display Name for every service on your computer.
2. Filtering Services by Name or Wildcard
You can search for specific services by passing names or wildcards:
Get-Service -Name "wuauserv"
To inspect all networking or Hyper-V services, use asterisks:
Get-Service -Name "Hyper*" | Format-Table -AutoSize
3. Listing Only Currently Running Services
To audit active background processes, pipe the results to Where-Object:
Get-Service | Where-Object {$_.Status -eq "Running"}
4. Inspecting Service Startup Types and Dependencies
By default, Get-Service omits the startup mode (Automatic, Manual, Disabled). Select specific object properties to inspect the full configuration:
Get-Service -Name "Spooler" | Select-Object Name, DisplayName, Status, StartType, DependentServices
The DependentServices property is particularly critical: it lists all secondary services that rely on the target service before you decide to terminate it.
Starting, Stopping, and Restarting Services
PowerShell provides dedicated companion cmdlets to change the operational state of any service:
Starting a Service
Start-Service -Name "wuauserv"
Stopping a Service
Stop-Service -Name "Spooler" -Force
The -Force parameter ensures that dependent services are also safely halted if required.
Restarting a Glitched Service
If the print spooler or audio daemon freezes, restart it in a single command:
Restart-Service -Name "Spooler" -Force
Configuring Startup Types Using Set-Service
The Set-Service cmdlet allows you to change how a service behaves when Windows 11 boots up:
1. Setting a Service to Automatic Startup
To ensure a critical service launches automatically during system boot:
Set-Service -Name "wuauserv" -StartupType Automatic
2. Setting a Service to Manual Startup
To prevent a service from running at boot while still allowing other programs or user triggers to launch it on demand:
Set-Service -Name "wuauserv" -StartupType Manual
3. Completely Disabling a Service
To lock down an unwanted background process permanently:
Set-Service -Name "DiagTrack" -StartupType Disabled
Handling Stuck Services (Force-Terminating Deadlocked PIDs)
Occasionally, a crashed service becomes trapped in a “Stopping” or “Pending” state, causing Stop-Service to time out. In this situation, retrieve the service’s underlying Process ID (PID) and terminate the thread directly:
- Query the PID associated with the stuck service name:
$ServicePID = (Get-CimInstance Win32_Service -Filter "Name='Spooler'").ProcessId - Verify the PID and kill the process:
Stop-Process -Id $ServicePID -Force - Once killed, restart the service normally with
Start-Service -Name "Spooler".
Best Practices for Service Management in PowerShell
- Verify Service Names vs Display Names: Always use the internal
Nameproperty (e.g.wuauserv) rather than the longDisplayName(e.g. “Windows Update”) in automated scripts to prevent localisation issues across different languages. - Use WhatIf for Safety: Before stopping sensitive system components, append the
-WhatIfparameter (e.g.Stop-Service -Name "LanmanServer" -WhatIf) to preview what actions PowerShell will take without executing them. - Check Dependent Services: Inspect
(Get-Service -Name "Service").RequiredServicesto ensure vital network or security prerequisites are running before launching a dependent daemon.
Mastering Get-Service and Set-Service in PowerShell gives you complete, programmable mastery over Windows 11 background architecture, streamlining troubleshooting and system administration.