问题
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.
回答1:
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.
回答2:
"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)
回答3:
you can do plenty with msi based installation via the msiexec command. You could run\spwan this from your scripting language of choice.
msiexec /?
You'll need the package information (mainly the GUID) - this can be found here:
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer
The Product
subkey is probably the most interesting for you.
HTH, Matt
来源:https://stackoverflow.com/questions/6978391/how-to-uninstall-any-application-using-python-or-and-ruby