Windows automatic screen lock feature consultation

wen wang 0 Reputation points
2024-11-15T02:49:21.5733333+00:00

System: Windows 10

Architecture: x86_64

Question: I am using Python to write a Windows baseline detection script (by checking the registry), and if it does not meet the requirements, a repair function is provided (by modifying the registry). I encountered a problem in the lock screen setting repair baseline. I set the registry key value (turn on automatic lock screen), and the function also took effect (automatic lock screen after timeout), but the Windows settings interface still shows that the lock screen is not turned on.

Registry to detect and set:

ScreenSaveActive, ScreenSaverIsSecure, ScreenSaveTimeOut keys under HKEY_USERS\sid\Control Panel\Desktop

// sid is obtained through whoami /user

Operation steps:

  1. The python script detects the corresponding registry value to determine whether automatic screen lock is enabled
  2. If not enabled, the python script modifies the registry value
  3. Manually check that the registry has been modified
  4. Quietly wait for the timeout to confirm that the lock screen is effective
  5. Right-click on the desktop->Personalization->Lock screen interface->Screen saver settings, and it is found that it is not enabled
  6. Restart the computer and repeat step 5, the same result

Post a post to consult how to achieve python repair of the registry, and the windows settings interface also follows the registry changes.

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
11,808 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.