6

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.

Community
  • 1
  • 1
Alexander.Iljushkin
  • 4,519
  • 7
  • 29
  • 46
  • Did you use WMI to install your application? If not, as noted in the linked question, the answers there will not find your application. – Conspicuous Compiler Aug 08 '11 at 06:22
  • Oh okay, i will try to install WMI. Thank you. And sorry for my inattention. But now I'm interested in realisation of this method using ruby or py. :-) – Alexander.Iljushkin Aug 08 '11 at 06:49
  • It would be hard or impossible. Python and Ruby are designed for Unix, not Windows. – Chris Warrick Aug 08 '11 at 07:43
  • It would would be quite easy with Python on windows, you would just need to run a command line. I can't comment on Ruby having never used it though. – Matt Aug 08 '11 at 09:48

3 Answers3

3

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.

ray_linn
  • 1,382
  • 10
  • 14
3

"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)

Bulwersator
  • 1,102
  • 2
  • 12
  • 30
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

Matt
  • 1,931
  • 12
  • 20