🐍 Python 3.10+
Check "Disable Lock Screen" Status (Python)
Reads the registry value behind the "Disable Lock Screen" tweak via winreg to confirm whether it's applied.
check_disable_lock_screen_status.py
#!/usr/bin/env python3
"""
check_disable_lock_screen_status.py
Checks whether "Disable Lock Screen" is currently applied.
Usage:
python check_disable_lock_screen_status.py
"""
import winreg
def main() -> None:
try:
key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Policies\Microsoft\Windows\Personalization")
value, _ = winreg.QueryValueEx(key, "NoLockScreen")
winreg.CloseKey(key)
print(f"Current value of 'NoLockScreen': {value}")
except FileNotFoundError:
print("'NoLockScreen' is not set (using the Windows default).")
if __name__ == "__main__":
main()