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