Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- # Filename: uninstall_edge_no_updates.py
- # Version: 1.00
- # Author: Jeoi Reqi
- """
- Description:
- This script uninstalls Microsoft Edge Spyware Browser from Windows 10 and prevents it from being automatically reinstalled.
- It retrieves the Edge version number automatically, uninstalls Edge Spyware using Command Prompt, and prevents Edge reinstall by modifying the registry.
- Requirements:
- - Windows 10
- - Python 3.x
- Usage:
- 1. Make sure you have Python installed on your Windows machine.
- 2. Run the script by executing `python uninstall_edge.py` in Command Prompt or PowerShell with administrator privileges.
- """
- import os
- import subprocess
- import winreg
- # Function to get the version
- def get_edge_version():
- """
- Retrieve the version number of Microsoft Edge Spyware installed on the system.
- Returns:
- - str: The version number of Microsoft Edge Spyware if found, otherwise None.
- """
- # Get Edge version from the application folder
- edge_path = os.path.join(os.getenv("ProgramFiles(x86)"), "Microsoft", "Edge", "Application")
- versions = [d for d in os.listdir(edge_path) if os.path.isdir(os.path.join(edge_path, d))]
- if versions:
- return versions[0]
- else:
- return None
- # Function to delete Edge
- def uninstall_edge(version):
- """
- Uninstall Microsoft Edge Spyware using Command Prompt.
- Args:
- - version (str): The version number of Microsoft Edge Spyware to uninstall.
- """
- if version is None:
- print("Microsoft Edge Spyware is not installed.")
- return
- # Navigate to Edge's Installer folder
- installer_path = os.path.join(os.getenv("ProgramFiles(x86)"), "Microsoft", "Edge", "Application", version, "Installer")
- os.chdir(installer_path)
- # Uninstall Edge using Command Prompt
- subprocess.run(["setup.exe", "--uninstall", "--system-level", "--verbose-logging", "--force-uninstall"])
- # Function to prevent Edge automatic reinstall
- def prevent_edge_reinstall():
- """
- Prevent Microsoft Edge Spyware from being automatically reinstalled by modifying the registry.
- """
- # Open Registry Editor
- key_path = r"SOFTWARE\Microsoft"
- key_name = "EdgeUpdate"
- value_name = "DoNotUpdateToEdgeWithChromium"
- with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, key_path, 0, winreg.KEY_ALL_ACCESS) as key:
- # Create EdgeUpdate key
- try:
- winreg.CreateKeyEx(key, key_name)
- except:
- pass
- # Create DWORD Value
- try:
- value = winreg.SetValueEx(key, value_name, 0, winreg.REG_DWORD, 1)
- except:
- pass
- if __name__ == "__main__":
- edge_version = get_edge_version()
- uninstall_edge(edge_version)
- prevent_edge_reinstall()
- print("Microsoft Edge Spyware has been uninstalled and prevented from being automatically reinstalled because it sucks!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement