Sometimes you don't have access to group policy or powercfg.exe and have a virtualized server that makes no sense to have screen lock on, when your desktop/laptop has its own screen locking provision and remoting in through your hardware is the only way the VM can be accessed. It's like locking your car doors when your car is inside of your locked garage.
These 2 registry files will cure that, so that you aren't constantly unlocking your servers, while going back and forth between them and Outlook and whatever else your daily duties involve.
If they change back, a PowerShell script may be required to start upon login to monitor the changes
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop]
"ScreenSaveActive"="0"
"ScreenSaverIsSecure"="0"
"ScreenSaveTimeOut"="4294000000"
"SCRNSAVE.EXE"="%systemroot%\\System32\\zscrnsave.scr"
Windows Registry Editor Version 5.00[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System]"NoDispScrSavPage"=dword:00000000"HideLogonScripts"=dword:00000000
These will keep you from proverbially (and pointlessly) locking your car inside of your locked garage
Here is a powershell script that will monitor the keys should they revert back inadvertently .
while($true)
{
$arr_regValueNamesAndValues = New-Object System.Collections.Generic.List[String];
$int_changesCount = 0;
$regHKCU = [Microsoft.Win32.Registry]::CurrentUser;
$regKeyRoot = $regHKCU.OpenSubKey("Software\Policies\Microsoft\Windows\Control Panel\Desktop", $true)
$valueNames = $regKeyRoot.GetValueNames();
foreach ($valueName in $valueNames)
{
$valueNameValue = $regKeyRoot.GetValue($valueName)
$arr_regValueNamesAndValues.Add([string]$valueName + "|" + [string]$valueNameValue);
}
foreach ($regValueNameAndValue in $arr_regValueNamesAndValues)
{
$regValueNameAndValueSplit = $regValueNameAndValue.Split("|");
if ($regValueNameAndValueSplit[0] -eq "ScreenSaveActive")
{
if ($regValueNameAndValueSplit[1] -ne "0")
{
$regKeyRoot.SetValue("ScreenSaveActive", "0", [Microsoft.Win32.RegistryValueKind]::String);
Write-Host " *** Set ScreenSaveActive to 0" ([DateTime]::Now.ToString());
$int_changesCount++;
}
}
elseif ($regValueNameAndValueSplit[0] -eq "ScreenSaverIsSecure")
{
if ($regValueNameAndValueSplit[1] -ne "0")
{
$regKeyRoot.SetValue("ScreenSaverIsSecure", "0", [Microsoft.Win32.RegistryValueKind]::String);
Write-Host " *** Set ScreenSaverIsSecure to 0" ([DateTime]::Now.ToString());
$int_changesCount++;
}
}
elseif ($regValueNameAndValueSplit[0] -eq "ScreenSaveTimeOut")
{
if ($regValueNameAndValueSplit[1] -ne "900")
{
$regKeyRoot.SetValue("ScreenSaveTimeOut", "900", [Microsoft.Win32.RegistryValueKind]::String);
Write-Host " *** Set ScreenSaveTimeOut to 900" ([DateTime]::Now.ToString());
$int_changesCount++;
}
}
else
{
#Write-Host "Unlisted regValueName" ([DateTime]::Now.ToString());
}
}
if ($int_changesCount -eq 0)
{
Write-Host "No changes needed" ([DateTime]::Now.ToString());
}
Sleep -Seconds 30;
}
keywords: disable screen timeout lock registry screen saver off display off powercfg.exe powercfg power options advanced settings power plan view change annoying