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

Auto Run PowerShell Script with Task Scheduler

Automation is king in today’s dynamic IT environments. Running PowerShell scripts with Task Scheduler is a vital skill set, particularly beneficial for system administrators to automate repetitive tasks and bolster efficiency with Windows Servers and clients. What is Task Scheduler? Task Scheduler is a built-in tool within the Microsoft Windows environment designed to simplify the
Read More

How to Disable or Enable USB Drives using Group Policy

When you connect a new USB device to your computer, Windows automatically detects the device and installs the appropriate driver. As a result, the user can use the connected USB drive or device almost immediately. If your organization’s security policy prohibits the use of portable USB storage devices (flash drives, USB hard drives, SD cards
Read More