Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to uninstall any application using python or (and) ruby

I didn't find any helpful topics over the webs by this question. These all about how to uninstall python or uninstall ruby but there are no information about the #{TOPIC}.

The main problem is that I used other interesting answers to try to uninstall an application using PowerShell script but all that didn't help me because that script with several variants of -Query "query" never finds my application even by unrigorous mask like '%APPL_NAME%' or by version number.

Seems like table Win32_Product filled uncorrectly or any function works bad now. Moreover, for me, it's not so cool to use PowerShell if I have such flexible languages.

So i'm interested in ways how to uninstall any program through the ruby or python.

Thank you for any ideas :-)

Edit: Let's I ask the question to another way. How to uninstall ordinary program which was installed thruogh the MSI installer

Edit: Why so strongly ? I'm not a perfect IT man moreover I'm from russia and don't know english well. I do not deserve minus ratings. You can stay it on zero. Thank you.

Edit: Thank's for all responses. I appreciate it.

like image 520
Alexander.Iljushkin Avatar asked Aug 08 '11 06:08

Alexander.Iljushkin


2 Answers

You can invoke WMIC command in ruby or python. the process is as following:

wmic product get name

This command will list all the software with a formal name, for example, to the office product, the name could be 'Microsoft office 20003 Pro' or 'Microsoft office 2003 Home & Student', you can use ruby or python to filter out what is the extacly name and then execute

wmic product where name='Microsoft office 2003 Home & Student' call uninstall

replace 'Microsoft office 2003 Home & Student' with the application you like.

if you prefer no to execute the wmic directly , and you can import python wmi or ruby wmi instead.

like image 193
ray_linn Avatar answered Oct 06 '22 01:10

ray_linn


"uninstall any program" - evil/badly designed program may create files hidden in many places - and I see no way to create program that can find all of them. (For example: any includes all kinds of malware)

like image 38
Bulwersator Avatar answered Oct 05 '22 23:10

Bulwersator