-
Notifications
You must be signed in to change notification settings - Fork 5
Configuring Windows Services
Configure and reconfigure Windows Services. Set the startup type and running state of Windows services to match your organization's baseline.
Important
This module requires installBehavior to be set to SYSTEM. Configuring Windows services requires elevated SYSTEM context. If the configuration uses USER install behavior, the module logs an error and is skipped.
The windowsServices module configures and manages Windows Services startup types and states. It controls service behavior to ensure consistent configuration across managed devices.
For each configured service, the module performs the following steps:
- Queries the current service status using
Get-Service - Retrieves the current
StartType(Automatic, Manual, Disabled) andStatus(Running, Stopped) - Compares the current
StartTypewith the desired configuration - If different, reconfigures the service
StartTypeusingSet-Service - Optionally stops running services if
StopIfRunningis enabled
The module is non-destructive - it only changes services that do not match the desired configuration. Service existence is verified before attempting any modifications.
Common use cases include disabling unnecessary services to improve performance or security, setting critical services to automatic startup, stopping and disabling telemetry or diagnostic services, and configuring services for enterprise compliance requirements.
The following shows the windowsServices configuration structure with examples of different startup types and the StopIfRunning option.
{
"windowsServices": {
"enabled": true,
"services": [
{
"Name": "XboxGipSvc",
"DisplayName": "Xbox Accessory Management Service",
"StartType": "Manual",
"StopIfRunning": false
},
{
"Name": "seclogon",
"DisplayName": "Secondary Logon",
"StartType": "Disabled",
"StopIfRunning": true
}
]
}
}The following properties are supported in the windowsServices section.
| Property | Description | Type | Required |
|---|---|---|---|
| windowsServices | |||
| enabled | Enable or disable the module | Boolean | No |
| services (array) | |||
| Name | Service name as returned by Get-Service
|
String | Yes |
| DisplayName | Friendly name of the service - used for logging and readability | String | No |
| StartType | Desired startup type - Automatic, Manual, Disabled, Boot, System, or LeaveAsIs
|
String | Yes |
| StopIfRunning | Stop the service if it is currently running. Uses -Force flag to ensure the service stops |
Boolean | No |
The commands below must be run from an elevated PowerShell prompt (Run as Administrator).
List all Windows services sorted by name with their current status and startup type.
Get-Service | Sort-Object "Name" | Select-Object "Name", "DisplayName", "Status", "StartType" | Format-Table -AutoSizeSearch for a service by name using a wildcard pattern.
Get-Service -Name "*xbox*" | Select-Object "Name", "DisplayName", "Status", "StartType"Retrieve the startup type of a specific service.
Get-Service -Name "seclogon" | Select-Object "Name", "DisplayName", "Status", "StartType"For more information, see the following resources.
- Get-Service - PowerShell reference for listing Windows services
- Set-Service - PowerShell reference for configuring Windows services
Page revised: March 4, 2026
🦎 Windows gecko - Desired state configuration for Windows devices · Repository · License
Windows gecko wiki
Getting Started
Feature Modules
- Configuring Windows Apps
- Configuring Windows branding
- Configuring Windows Config
- Configuring Windows Features
- Configuring Windows Files
- Configuring Windows Groups
- Configuring Windows Registry
- Configuring Windows Run
- Configuring Windows Scheduled Tasks
- Configuring Windows Services
- Configuring Windows TCR
Contributing