🐍 Python 3.10+

Disable Windows Spotlight on Desktop (Python)

Turns off the Windows Spotlight rotating desktop background feature. Applies the tweak via the stdlib winreg module.

By WindowsScripting.com · 621 B
set_disable_windows_spotlight.py
#!/usr/bin/env python3
"""
set_disable_windows_spotlight.py

Disable Windows Spotlight on Desktop.
Turns off the Windows Spotlight rotating desktop background feature.

Usage:
    python set_disable_windows_spotlight.py
"""

import winreg


def main() -> None:
    key = winreg.CreateKeyEx(
        winreg.HKEY_CURRENT_USER, r"Software\Policies\Microsoft\Windows\CloudContent", 0, winreg.KEY_SET_VALUE
    )
    winreg.SetValueEx(key, "DisableSpotlightCollectionOnDesktop", 0, winreg.REG_DWORD, 1)
    winreg.CloseKey(key)
    print("Disable Windows Spotlight on Desktop applied.")


if __name__ == "__main__":
    main()