Log on as a service (SeServiceLogonRight) is a Windows user permission that enables specific applications or network services to run in the background on behalf of a user account, regardless of whether the user is logged in. In this guide, we’ll cover how to grant “Log on as a service” rights in Windows using the Local Security Policy, domain GPO, the command line, or PowerShell, along with configuring a service to run under a specific user account.
Keep in mind that the “Log on as a service” right only controls whether an account can start a Windows service (it does not restrict what the service can access once running). The actual security boundary depends on NTFS permissions, token privileges, and service config.
Log on as a service is different from Log on as a batch job (SeBatchLogonRight), which is used for scheduled tasks and automation jobs rather than Windows services.
Supported Windows Versions
The procedures described in our guide apply to the following Windows versions:
- Windows Server 2019
- Windows Server 2022
- Windows Server 2025
- Windows 10
- Windows 11
The Local Security Policy, Group Policy, and secedit.exe methods are applicable to supported Windows versions. PowerShell examples using Set-Service -Credential require PowerShell 6.0 or later and are supported on Windows.
What is “Log on as a Service” in Windows?
“Log on as a service” is a security policy that allows a specific user to launch network services or to register a process as a service running on the system, without the user being logged in locally. This policy is used when you need to run a specific application or service on a computer in the background, without user interaction and without granting local administrator or SYSTEM privileges.
Running Windows network services under a dedicated user or service account rather than a built-in system account, such as Local System, Network Service, or Local Service, improves security and management and enhances process isolation. According to security best practices, interactive and remote interactive sessions for such service accounts can be disabled.
Note that modern Windows services may also run under virtual service accounts (such as NT SERVICE). This provides service isolation without requiring password management.

Adhering to the principle of least privilege, a dedicated service account limits the potential damage that could be caused by a compromise, as the service cannot access the entire server or domain.
We recommend using Group Managed Service Accounts (gMSA) over traditional service accounts because they eliminate password management. When a gMSA is configured correctly as the logon account for a Windows service, Windows may automatically grant the required Log on as a service right. In other deployment cases, you may need to assign the SeServiceLogonRight user right explicitly.

Windows Server 2025 also introduces Delegated Managed Service Accounts (dMSA). They provide machine-bound managed identities and support migration from traditional domain service accounts. You should consider dMSA for compatible services when planning service account modernization. Unlike gMSA, dMSA is designed for a specific computer identity.
Configure ‘Log on as a Service’ Right via Group Policy
You can configure the “Log on as a service” rights assignment via the local or domain group policy. Use the Local Security Policy (secpol.msc) to configure the policy on a standalone computer. Or, use the Group Policy Management console (gpmc.msc), create and configure new GPO to set ‘Logon as service’ permissions for multiple domain computers.
- Navigate to Security Settings → Local Policies → User Rights Assignment and double-click the “Log on as a service” policy.

- By default, only the NT SERVICE\ALL SERVICES group is specified here. Click Add User or Group.

- Specify the groups or users (domain or local) to grant “Log on as a service” rights and click OK. You can add local or domain users and groups.

- Click OK to save the list.

- Wait for the Group Policy update or run gpupdate /force to force the update immediately.

In order to verify the effective “Log on as a service” assignment on a machine, you should use Resultant Set of Policy (rsop.msc) and navigate to Computer Configuration → Windows Settings → Security Settings → Local Policies → User Rights Assignment.
You can also export the effective local security policy with the command:
secedit /export /cfg C:\temp\secpol.cfg
Then search the exported policy file for the SeServiceLogonRight entry:
findstr /i "SeServiceLogonRight" C:\temp\secpol.cfg
Some tips
- When a Group Policy Object configures the Log on as a service user right, it replaces the existing assignment list rather than merging with local security policy settings. The GPO must therefore contain the complete list of accounts and groups that require this right on the targeted computers. Any existing assignments not included in the effective GPO can be removed when the policy is applied.
- Ensure that the user account has not been added to the ‘Deny logon as a service’ policy, since this policy setting takes precedence. This policy always takes precedence over “Allow log on as a service”, even in case both are configured through GPO/locally.
- In case multiple GPOs define Log on as a service, the final applied policy depends on Group Policy precedence and security filtering. Note that conflicts may result in accounts being removed unexpectedly from the effective policy list.
- Keep in mind that domain Group Policy overrides local security policy settings during Group Policy refresh. In case you configured SeServiceLogonRight through a domain GPO, local changes made with secpol.msc/secedit may be reverted automatically.
Important. Group Policy replaces the existing Log on as a service assignments rather than merging them with local settings. If the GPO contains only custom service accounts, required service identities may be removed, potentially preventing SQL Server, Hyper-V, and other services from starting. Before deploying the GPO, you need to preserve NT SERVICE\ALL SERVICES where required, along with other existing service identities and all application-specific accounts that need SeServiceLogonRight. Test the resulting policy on representative servers before domain-wide deployment.
Granting Log on as a Service Right with PowerShell
Note that Microsoft does not provide a dedicated built-in PowerShell cmdlet to manage user rights assignment. We recommend you using secedit or LGPO-based automation in enterprise environments.
You can change the settings for the ‘Log on as a service’ policy from the PowerShell command line. Below we will use the built-in secedit.exe command to manage a computer’s local User Rights Assignment settings.
We have created three PowerShell script wrappers for the ‘secedit.exe’ tool. These can be used to check, grant, or revoke the SeServiceLogonRight for a user from the PowerShell console.
- [PS-Manage-Log-On-As-A-Service] — The public GitHub repository.
- [Get-ServiceLogonRight.ps1] — A script to retrieve the local machine’s current “Log on as a service” rights.
- [Add-ServiceLogonRight.ps1] — A script to add a user and group to the “Log on as a service” policy.
- [Remove-ServiceLogonRight.ps1] — A script to remove a user or group from the current “Log on as a service” policy.
List the current accounts in the “Log on as a service” policy:
.\Get-ServiceLogonRight.ps1

Add a user or group to the “Log on as a service” policy:
.\Add-ServiceLogonRight.ps1 -UserOrGroup <DOMAIN\group>

Remove a user from a policy:
# Remove a local user
.\Remove-ServiceLogonRight.ps1 -UserOrGroup localadmin02
Configure Windows Service to Run Under a User Account User
As we mentioned above, most Windows Services are, by default, running as a System, Network, or Local service account. Once you have granted a user the ‘Log on as a Service’ right, you can reconfigure the service to run in this user context.
- Open the service management console (services.msc).
- Find the service and open its properties.
- Go to the Log on tab > select This account.
- Select account name and type its password.

The account CONTOSO\svcSQL01 has been granted the Log On As A Service right
- Try starting the service to check if it works correctly in the user’s context.
Note. If the SeServiceLogonRight has not yet been granted, this will also make changes to the User Rights Assignment security policy.

The Set-Service cmdlet in PowerShell 6.0 and later includes the -Credential parameter, which allows you to config a Windows service to run under a traditional local/domain user account. This parameter requires a PSCredential object containing the account name and password.
Important. This method is not suitable for Group Managed Service Accounts (gMSA), which use automatically managed passwords that administrators do not enter manually. You need to configure gMSA service identities using the service’s supported config method instead.
$ServiceName = 'MSSQL$SQLEXPRESS'
$creds = Get-Credential
Set-Service -Name $ServiceName -Status Stopped
Set-Service -Name $ServiceName -Credential $creds
Set-Service -Name $ServiceName -Status Running
Keep in mind that you should avoid hardcoding passwords in PowerShell scripts. Instead we recommend using Get-Credential, gMSA accounts, or secure secret management solutions.
Note that in newer PowerShell versions, Set-Service gives limited support for configuring credentials on some platforms/environments.
In order to list Windows services configured to run under accounts other than Local System, use this PowerShell command:
Get-CIMInstance -Class Win32_Service -filter "StartName != 'LocalSystem' AND NOT StartName LIKE 'NT Authority%' " | Select-Object Name, Caption, StartMode, StartName, State|ft

Troubleshooting Error 1069 (Logon Failure)
An error may occur when starting the service:
Could not start the <service name> service on Local Computer.
Error 1069: The service did not start due to a logon failure.
This can indicate that:
- Incorrect user credentials are specified
- The user account is disabled or locked out
- “Log on as a service” permissions are missing
Here are additional root causes for Error 1069:
- Expired password for service account
- Account locked due to failed logon attempts
- The service account is included in the Deny log on as a service (SeDenyServiceLogonRight) assignment. This policy takes precedence over Log on as a service (SeServiceLogonRight), preventing the account from logging on as a service.
For traditional service accounts, you need to ensure that password rotation procedures are documented and synced with service config updates. In enterprise environments, we recommend using gMSA accounts, this will help to avoid password expiration and manual password management problems.
Check Service Control Manager Events
When troubleshooting Error 1069, first you need to check the System event log for Service Control Manager event ID 7038. This event can provide additional info about why Windows could not log on the service account.
Run the following PowerShell command:
Get-WinEvent -FilterHashtable @{
LogName = 'System'
ProviderName = 'Service Control Manager'
Id = 7038
StartTime = (Get-Date).AddHours(-24)
} |
Select-Object TimeCreated, Id, Message |
Format-List You need to review the event message for authentication failures, incorrect credentials, or other service account logon problems.
You can audit changes to the Log on as a service (SeServiceLogonRight) and Deny log on as a service (SeDenyServiceLogonRight) assignments using Windows Security event logs.
The following events are relevant:
- Event ID 4717 — System security access was granted to an account.
- Event ID 4718 — System security access was removed from an account.
These events are generated when logon user rights are assigned/removed. To enable auditing, you need to config the Audit Authentication Policy Change subcategory under Computer Configuration → Policies → Windows Settings → Security Settings → Advanced Audit Policy Configuration → System Audit Policies → Policy Change → Audit Authentication Policy Change.
Here you need to set the following:
- Configure the following audit events: Enabled
- Success: Enabled
The events are recorded in the Windows Security log. In enterprise environments, you can forward them to a SIEM platform for centralized monitoring.


Thank you. Literally NO ONE in Enterprise IT understands this about most of the stuff in the USer Rights Assignment of Group Policy. I’ve fixed so many outages due to admins settings this via GPO across many servers and overwriting what’s already set in there by x, y, z application that was installed who put accounts in there. Admins just blindly follow along application documentation or posts like this. I’m so tired of it.
– Angry Sr. Systems Admin LOL
Been like this for 20 years now.
Microsoft really needs to add switches for append, remove and replace for setting group policy objects, or just remove these from GPO management altogether as it’s half baked.
Please follow this up with how to set Logon As a Service for a user or group policy on Windows Server 2016 Core – there is no GUI, no control panel, no gpedit.msc, no gpmc.msc, no services.msc, etc etc.
For example, to setup Jenkins requires a user account with Logon As a Service enabled. Thank you