How can i create a program in python, to uninstall a program in Windows both for msi and exe silently | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can i create a program in python, to uninstall a program in Windows both for msi and exe silently

I have tried using the subprocess module, also tired creating a bat file and calling it in the program. but none worked without throwing a guid for client interaction to confirm the installation, I have also tried using the pypsexec module but I run into program running without terminating. I have also tried the winapp module but unfortunately it only lists MSI installed programs only.. is there a way to approach the uninstation through the command prompt (subprocess module) commands to uninstall quietly... I am working with the LINE program for testing. calling the uninstall string as a command to the prompt parsing the /uninstall /s /qb /qn /norestart arguements. something like this: subprocess.call(executable=r"C:\users\username\AppData\Local\LINE\bin\LineUnInst.exe",arts="/system /uninstall /X /s /qn /qb /norestart", shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE) the above always throw a guid to confirm uninstalling, which defeats the purpose of the script. I need a pointer to get it working

6th May 2020, 8:42 PM
Amanze Arthur
Amanze Arthur  - avatar
1 Answer
+ 1
You can't do this in windows without promoting UAC. This is a security feature. If you're not trying to create malware, you could always run the process as an administrator and the elevated privileges should apply when trying to uninstall the program.
4th Jun 2020, 2:49 AM
Ben Allen (Njinx)
Ben Allen (Njinx) - avatar