# Set-EventSaverPower.ps1 # # Keep shopfloor monitors + PCs awake so the EventSaver ad screensaver is # actually visible. Runs under GE-Enforce (SYSTEM) every cycle (Always). # Sets monitor-off + sleep to Never on the ACTIVE power scheme, so a screen # never blanks out from under the screensaver. Re-applies each cycle, so a # power-plan change is corrected on the next enforce pass. # # Screensaver must trigger before any monitor-off would - with monitor-off # set to Never here, the screensaver (2-10 min idle) always wins. $ErrorActionPreference = 'Continue' $logDir = 'C:\Logs\Shopfloor' if (-not (Test-Path $logDir)) { New-Item -ItemType Directory -Path $logDir -Force | Out-Null } $log = Join-Path $logDir 'eventsaver.log' function Write-Log($m) { Add-Content -LiteralPath $log -Value ("{0} {1}" -f (Get-Date -Format 'yyyy-MM-dd HH:mm:ss'), $m) } # 0 = Never. Cover monitor + standby, AC + DC (shopfloor PCs are AC, DC is # harmless belt-and-suspenders). & powercfg /change monitor-timeout-ac 0 2>&1 | Out-Null & powercfg /change monitor-timeout-dc 0 2>&1 | Out-Null & powercfg /change standby-timeout-ac 0 2>&1 | Out-Null & powercfg /change standby-timeout-dc 0 2>&1 | Out-Null Write-Log "power: monitor-off + sleep set to Never (AC+DC) for EventSaver visibility" exit 0