C# uninstall a program on Windows 7

Hello,
I would like to find a way to uninstall a software by looking up the registry and find the msi file to launch with the uninstall commandline switch.
Basically, I can't find an elegant way to look into the appropriate registry path to find this info.
I know the place in the registry is different on my Windows 7 64-bits that what I've found on the Internet so far.
Is there a way compatible with all the versions of Windows?
I would do the lookup based on the msi name.
Thanks for your help
jmlacosteAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AndyAinscowFreelance programmer / ConsultantCommented:
If it is installed via an msi then it should appear in the list of programs available for de-installation from the control panel.
Are you saying it doesn't ?
Or do you want to do it programatically ?
0
jmlacosteAuthor Commented:
Hi AndyAinscow

Yes I would like to do it programmatically from looking up an MSI name in the registry.
The software is available in the de-installation screen in control panel.
I was just saying that the registry path that I've found on the Internet to check what software is installed is different on my version of windows: I can find my software in HKLM\Software\Wow6432Node but the various solutions online are talking about something more like this: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
Hence I'm looking for a way to programmatically uninstall a specific MSI on all Windows versions (XP, Vista, 2003...)

Thanks again ;)
0
Mike_MozhaevCommented:
Look at the function MsiEnumProductsEx() if you don't know the product code.
Then use MsiInstallProduct() to install or uninstall product.

You can find a .NET declaration of these functions on pinvoke.net
E.g. http://pinvoke.net/default.aspx/msi/MsiInstallProduct.html
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jmlacosteAuthor Commented:
I didn't have the chance to actully implement this solution but it looks like the right direction to look into.
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.