Advertisement
Python253

disable_securityhealth_startup

Mar 18th, 2024
838
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.51 KB | None | 0 0
  1. #!/usr/bin/env python3
  2. # Filename: disable_securityhealth_startup.py
  3. # Version: 1.00
  4. # Author: Jeoi Reqi
  5.  
  6. """
  7. DISABLE SECURITY HEALTH FROM STARTUP APPS:
  8.  
  9. - This script removes 'SecurityHealth' from the startup menu on Windows OS.
  10. - It accomplishes this by setting the registry value to '0' (Disabled).
  11. - You can edit the value back to '1' (Enabled) at any time.
  12.  
  13. Requirements:
  14. - Python 3
  15. - Compatible Windows OS Versions: (Vista-11)
  16.  
  17. Note:
  18. - This script requires elevated administrator permissions to edit the registry.
  19. - It is recommended to create a backup of the registry before making any changes.
  20. """
  21.  
  22. import winreg
  23.  
  24. # Function to disable a startup entry in the Windows registry.
  25. def disable_startup_entry(entry_name):
  26.     """
  27.    This function removes the specified startup entry from the Windows registry, effectively disabling it
  28.    from running automatically when the system starts up.
  29.  
  30.    Args:
  31.        entry_name (str): The name of the startup entry to be disabled.
  32.    """
  33.     key_path = r"Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run"
  34.     with winreg.OpenKey(winreg.HKEY_CURRENT_USER, key_path, 0, winreg.KEY_ALL_ACCESS) as key:
  35.         try:
  36.             winreg.DeleteValue(key, entry_name)
  37.             print(f"\nDisabled startup entry: {entry_name}\n")
  38.         except FileNotFoundError:
  39.             print(f"\nStartup entry not found: {entry_name}\n")
  40.  
  41. if __name__ == "__main__":
  42.     startup_entry = "SecurityHealthSystray"
  43.     disable_startup_entry(startup_entry)
  44.  
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement