Settings all at Never. Screen saver disbled. Tried the microsoft site recommended fixes. No help.
Problem just started today. Was not always like this.
Didn't see the 10 minute autolock. Reset to NEVER for battery and plugged in for shutting PC down. Asked Wayne to restart his PC when he could.
Script Below __________________________________________________________________________
<#
.SYNOPSIS
Stops a Windows 11 machine locking / blanking after ~60 seconds.
.DESCRIPTION
RUN THIS AS THE AFFECTED USER, in their own logged-on session.
Do NOT run it as an admin account - everything it changes is per-user
(HKCU and that user's own power scheme), so running it as someone else
fixes the wrong profile. No elevation required.
It addresses both possible causes in one pass, because the symptom
("screen goes away after a minute") looks identical either way:
1. SCREEN SAVER - ScreenSaveActive=1 with ScreenSaveTimeOut=60.
Disabled outright here, and applied to the LIVE session via
SystemParametersInfo so it takes effect without a logoff.
2. POWER / DISPLAY - monitor switching off after 60s, combined with
"require a password on wakeup" (CONSOLELOCK). Display timeout is
raised to 15 minutes and the wake password prompt is turned off.
It also reports whether an OEM walk-away lock is installed (Dell
Optimizer, HP Presence, Lenovo Vantage). Those lock on their own
schedule and cannot be fixed from here - if one is present and the
problem survives this script, that is your culprit.
.PARAMETER DisplayTimeoutMinutes
Minutes before the display switches off. Default 15. Use 0 for never.
.EXAMPLE
.\Fix-FastLock.ps1
.EXAMPLE
.\Fix-FastLock.ps1 -DisplayTimeoutMinutes 20
.NOTES
Changes only the current user's settings. Reversible - the "before"
values are printed so you can put them back.
#>
[CmdletBinding()]
param(
[int]$DisplayTimeoutMinutes = 15
)
$ErrorActionPreference = 'Continue'
$desktop = 'HKCU:\Control Panel\Desktop'
function Show-Header($text) {
Write-Host ""
Write-Host "=== $text ===" -ForegroundColor Cyan
}
Write-Host ""
Write-Host "Running as: $env:USERDOMAIN\$env:USERNAME on $env:COMPUTERNAME" -ForegroundColor White
Write-Host "(if that is not the affected user, stop now - this fixes the wrong profile)" -ForegroundColor Yellow
# ---------------------------------------------------------------- BEFORE ----
Show-Header "BEFORE"
$before = Get-ItemProperty -Path $desktop -ErrorAction SilentlyContinue
foreach ($v in 'ScreenSaveActive','ScreenSaveTimeOut','ScreenSaverIsSecure','SCRNSAVE.EXE') {
$val = $before.$v
if ($null -eq $val) { $val = '(not set)' }
Write-Host (" {0,-22} {1}" -f $v, $val)
}
Write-Host ""
Write-Host " Current display-off timeouts (seconds, 0 = never):"
$vid = powercfg /q SCHEME_CURRENT SUB_VIDEO VIDEOIDLE 2>$null
($vid | Select-String 'Power Setting Index') | ForEach-Object {
Write-Host " $($_.Line.Trim())"
}
Write-Host ""
Write-Host " Require password on wake (CONSOLELOCK, 1 = yes):"
$lock = powercfg /q SCHEME_CURRENT SUB_NONE CONSOLELOCK 2>$null
($lock | Select-String 'Power Setting Index') | ForEach-Object {
Write-Host " $($_.Line.Trim())"
}
# ------------------------------------------------------- 1. SCREEN SAVER ----
Show-Header "1. Disabling the screen saver"
New-ItemProperty -Path $desktop -Name 'ScreenSaveActive' -Value '0' -PropertyType String -Force | Out-Null
New-ItemProperty -Path $desktop -Name 'ScreenSaveTimeOut' -Value '900' -PropertyType String -Force | Out-Null
New-ItemProperty -Path $desktop -Name 'ScreenSaverIsSecure' -Value '0' -PropertyType String -Force | Out-Null
Remove-ItemProperty -Path $desktop -Name 'SCRNSAVE.EXE' -Force -ErrorAction SilentlyContinue
Write-Host " Registry values written." -ForegroundColor Green
# Push it into the running session so a logoff is not required.
try {
Add-Type -ErrorAction Stop @"
using System;
using System.Runtime.InteropServices;
public class SpiHelper {
[DllImport("user32.dll", SetLastError = true)]
public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, IntPtr pvParam, uint fWinIni);
}
"@
# SPI_SETSCREENSAVEACTIVE = 0x0011, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE = 0x03
$ok = [SpiHelper]::SystemParametersInfo(0x0011, 0, [IntPtr]::Zero, 0x03)
if ($ok) { Write-Host " Applied to the live session - no logoff needed." -ForegroundColor Green }
else { Write-Host " Live apply failed; log off and back on instead." -ForegroundColor Yellow }
}
catch {
Write-Host " Could not apply live ($($_.Exception.Message)); log off and back on." -ForegroundColor Yellow
}
# ------------------------------------------------------ 2. POWER SETTINGS ----
Show-Header "2. Fixing display / power"
powercfg /change monitor-timeout-ac $DisplayTimeoutMinutes | Out-Null
powercfg /change monitor-timeout-dc $DisplayTimeoutMinutes | Out-Null
Write-Host " Display-off set to $DisplayTimeoutMinutes minute(s) on AC and battery." -ForegroundColor Green
powercfg /setacvalueindex SCHEME_CURRENT SUB_NONE CONSOLELOCK 0 2>$null
powercfg /setdcvalueindex SCHEME_CURRENT SUB_NONE CONSOLELOCK 0 2>$null
powercfg /setactive SCHEME_CURRENT 2>$null
Write-Host " Password-on-wake turned off." -ForegroundColor Green
# ----------------------------------------------------- 3. OEM WALK-AWAY ----
Show-Header "3. Checking for an OEM walk-away lock"
$oem = @(
@{ Name = 'Dell Optimizer (ExpressSign-in / Walk Away Lock)'; Test = { (Get-Service -Name '*Optimizer*','*DellOptimizer*' -ErrorAction SilentlyContinue) -or (Test-Path 'C:\Program Files\Dell\DellOptimizer') } }
@{ Name = 'HP Presence / HP Auto Lock and Awake'; Test = { (Get-Service -Name '*HP*Presence*','*HPAuto*' -ErrorAction SilentlyContinue) -or (Test-Path 'C:\Program Files\HP\HP Presence') } }
@{ Name = 'Lenovo Commercial Vantage (Zero-Touch Lock)'; Test = { (Get-Service -Name '*Lenovo*Vantage*','*ImController*' -ErrorAction SilentlyContinue) -or (Test-Path 'C:\Program Files (x86)\Lenovo\VantageService') } }
)
$found = $false
foreach ($o in $oem) {
$present = $false
try { $present = [bool](& $o.Test) } catch { }
if ($present) {
$found = $true
Write-Host " FOUND: $($o.Name)" -ForegroundColor Yellow
}
}
if (-not $found) {
Write-Host " None detected." -ForegroundColor Green
} else {
Write-Host ""
Write-Host " This cannot be fixed from a script - it has its own timer that" -ForegroundColor Yellow
Write-Host " ignores Windows settings, and 1 minute is its factory default." -ForegroundColor Yellow
Write-Host " Open the app above and turn off the walk-away / proximity lock." -ForegroundColor Yellow
}
# ----------------------------------------------------------------- AFTER ----
Show-Header "AFTER"
$after = Get-ItemProperty -Path $desktop -ErrorAction SilentlyContinue
foreach ($v in 'ScreenSaveActive','ScreenSaveTimeOut','ScreenSaverIsSecure') {
$val = $after.$v
if ($null -eq $val) { $val = '(not set)' }
Write-Host (" {0,-22} {1}" -f $v, $val)
}
Write-Host ""
$vid2 = powercfg /q SCHEME_CURRENT SUB_VIDEO VIDEOIDLE 2>$null
($vid2 | Select-String 'Power Setting Index') | ForEach-Object {
Write-Host " $($_.Line.Trim())"
}
Show-Header "NEXT"
Write-Host " 1. Leave the laptop completely alone for 3 minutes and watch."
Write-Host " 2. If it still goes away, note EXACTLY what happens:"
Write-Host " - screen black, mouse wiggle brings it back, no password -> display power"
Write-Host " - sign-in screen, password required -> OEM lock or sleep"
Write-Host " 3. Then reboot, log back in, and re-run this script's BEFORE"
Write-Host " section to confirm nothing reverted the values."
Write-Host ""