0

I'm using Spyder as an IDE on Windows 10 and I've been searching for python programs that will uninstall particular applications upon execution. So far, I have found a couple of sources:

  • Stackoverflow: The wmic command does not seem to be recognized by Spyder and returns an invalid syntax error.
  • Winapps: Except the list applications command none of the other functions return any values. I tried the following code but to no avail:
for app in winapps.search_installed('[app_name]'):
        print(app)

winapps.uninstall('[app_name]', args=['/S'])

Are there any other modules and/or methods I can use to uninstall applications on my system?

1 Answers1

0

If you can call PowerShell commands with Administratos rights, maybe could you use this method:

List the installed applications:

Get-WmiObject -Class Win32_Product | Select-Object -Property Name

Create a variable with informations about the app that you want to uninstall:

$MyApp = Get-WmiObject -Class Win32_Product | Where-Object{$_.Name -eq "Java Auto Updater"}

And after, just call the Uinstall Method:

$MyApp.Uninstall()

enter image description here

  • I've trying to uninstall a couple of apps such as discord, which don't seem to appear with the Get-WmiObject -Class Win32_Product | Select-Object -Property Name command, but it does not list the app. How do I overcome this issue? – Prateek Ravindran Feb 05 '21 at 06:46