Fix Windows Log-On Issues by Repairing Critical Services and Forcing Group Policy

Windows log-on problems are often caused by important background services being disabled or stuck. When this happens, users may not be able to sign in properly, profiles can fail to load, or Group Policy simply stops working.

This PowerShell script checks all critical Windows services required for user log-on, sets them back to Automatic, starts anything that is not running, and then forces a full Group Policy update.

It is a quick and safe way to recover broken machines without rebuilding them.


Why people need this script

This script is useful when:

  • Users cannot log in or get stuck on “Preparing Windows”

  • User profiles load slowly or fail

  • Group Policy settings stop applying

  • Network or domain features disappear

  • Machines behave as if they are no longer part of the domain


Script

<#
.SYNOPSIS
Repairs Windows services required for user log-on and forces Group Policy refresh.

.DESCRIPTION
This script:
- Sets critical log-on services to Automatic
- Starts any that are stopped
- Forces a full Group Policy refresh

.NOTES
Author: DIGITALGEEKERY
Version: 1.1
#>

$Services = @(
"ProfSvc",
"gpsvc",
"EventLog",
"RpcEptMapper",
"netprofm",
"nlasvc",
"WlanSvc",
"lanmanworkstation"
)

foreach ($Service in $Services) {
Set-Service -Name $Service -StartupType Automatic -ErrorAction SilentlyContinue
Start-Service -Name $Service -ErrorAction SilentlyContinue
}

Start-Process "gpupdate.exe" -ArgumentList "/force" -Wait

Write-Output "Critical services checked and Group Policy refresh completed."

Total
0
Shares
Previous Post
Fix Windows Audio & Chrome Call Issues with One PowerShell Script

Fix Windows Audio & Chrome Call Issues with One PowerShell Script

Next Post

Find and Clean Up Inactive Computers in Active Directory with PowerShell

Related Posts

How to Set Proxy Settings via Group Policy?

The article shows how to use Active Directory Group Policies (GPOs) to configure proxy server settings on domain-joined computers running Windows 10/11 and Windows Server 2022/2019/2016/2012R2. These proxy server settings are used by all modern browsers, including Internet Explorer 11 (reached end of support on June 2022), Google Chrome, Microsoft Edge, Opera, and Mozilla Firefox
Read More