473,320 Members | 1,746 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Programmatically uninstall a program?

I am writing a C# program that needs to see if a particular program is
installed (it would be listed in the "Add or Remove Programs" list from the
Control Panel) and uninstall it.
Is there a way to do this?.. Thanks for any help... Bryan
Nov 15 '05 #1
5 27556
All this information is stored in the registry. You can take a look at the
registry key LocalMachine/Software/Installer/Products. There might be a
better way though.

"Bryan" <br*********@hotmailX.comX> wrote in message
news:#O**************@tk2msftngp13.phx.gbl...
I am writing a C# program that needs to see if a particular program is
installed (it would be listed in the "Add or Remove Programs" list from the Control Panel) and uninstall it.
Is there a way to do this?.. Thanks for any help... Bryan

Nov 15 '05 #2
Thanks for the reply. I'm sure I can get a list of the currently installed
programs, but what I really need to know is how to uninstall them. Any
ideas?

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:eF**************@TK2MSFTNGP12.phx.gbl...
All this information is stored in the registry. You can take a look at the registry key LocalMachine/Software/Installer/Products. There might be a
better way though.

"Bryan" <br*********@hotmailX.comX> wrote in message
news:#O**************@tk2msftngp13.phx.gbl...
I am writing a C# program that needs to see if a particular program is
installed (it would be listed in the "Add or Remove Programs" list from

the
Control Panel) and uninstall it.
Is there a way to do this?.. Thanks for any help... Bryan


Nov 15 '05 #3
Bryan,
To expand on what Peter was talking about, look for a key named
UninstallString. The key holds a value that Add\Remove Programs executes
when you click "Remove". You can execute the UninstallString from a command
line or programmatically. I have pasted an example below. I use Windows XP
Professional, so the key path may vary. HTH

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curr entVersion\Installer\UserD
ata\S-1-5-18\Products\9040110900063D11C8EF10054038389C\Insta llProperties
DisplayName: Microsoft Office Professional Edition 2003
UninstallString: MsiExec.exe /I{90110409-6000-11D3-8CFE-0150048383C9} <-
You can execute this from the command line.

--
Jason Newell
Software Engineer
The Charles Machine Works, Inc.
"Bryan" <br*********@hotmailX.comX> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I am writing a C# program that needs to see if a particular program is
installed (it would be listed in the "Add or Remove Programs" list from the Control Panel) and uninstall it.
Is there a way to do this?.. Thanks for any help... Bryan

Nov 15 '05 #4
C P
If the software was installed with Windows Installer, then you can use the
Windows Installer API, which has the ability to list all installed programs,
features, and components, as well as version information and lots more. You
can call functions to uninstall what you need. See
http://msdn.microsoft.com/library/de..._installer.asp

If Windows Installer hasn't been used, the you could use the technique from
Jason (assuming the installer properly wrote to the registry - if the
install was home-brewed, you may not be able to uninstall it automatically).
"Jason Newell" <no****@nospam.com> wrote in message
news:eg**************@TK2MSFTNGP09.phx.gbl...
Bryan,
To expand on what Peter was talking about, look for a key named
UninstallString. The key holds a value that Add\Remove Programs executes
when you click "Remove". You can execute the UninstallString from a command line or programmatically. I have pasted an example below. I use Windows XP Professional, so the key path may vary. HTH

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curr entVersion\Installer\UserD ata\S-1-5-18\Products\9040110900063D11C8EF10054038389C\Insta llProperties
DisplayName: Microsoft Office Professional Edition 2003
UninstallString: MsiExec.exe /I{90110409-6000-11D3-8CFE-0150048383C9} <- You can execute this from the command line.

--
Jason Newell
Software Engineer
The Charles Machine Works, Inc.
"Bryan" <br*********@hotmailX.comX> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I am writing a C# program that needs to see if a particular program is
installed (it would be listed in the "Add or Remove Programs" list from

the
Control Panel) and uninstall it.
Is there a way to do this?.. Thanks for any help... Bryan


Nov 15 '05 #5
Thanks everyone for your help. I am able to use both techniques to
accomplish my task.

"Bryan" <br*********@hotmailX.comX> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I am writing a C# program that needs to see if a particular program is
installed (it would be listed in the "Add or Remove Programs" list from the Control Panel) and uninstall it.
Is there a way to do this?.. Thanks for any help... Bryan

Nov 15 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Pengyu Hong | last post by:
How to build an uninstall program? Thanks a lot, Pengyu.
2
by: Pengyu Hong | last post by:
How to build an uninstall program for an installation program I created? Thanks a lot, Pengyu.
0
by: Henry Seymour | last post by:
I've developed a Windows application and used the Click-Once Deployment. In that application I would like to allow the user a click-once method of uninstalling it. I do not find an uninstall...
1
by: resander | last post by:
I need to uninstall DB2 Express on a W2K Server as the evaluation period has expired to reclaim a fair chunk of disk space. The program was not in the list of the Windows Add/Remove Programs in...
0
by: Henry Seymour | last post by:
I've developed a Windows application and used the Click-Once Deployment. In that application I would like to allow the user a click-once method of uninstalling it. I do not find an uninstall...
3
by: Henry Seymour | last post by:
I've developed a .Net Windows Form application and used the Click-Once Deployment. In that application I would like to allow the user a click-once method of uninstalling it. I do not find an...
2
by: Jerry | last post by:
Hi I have noticed that my apps don't have an uninstall capacity in the users programs shortcuts. While users can remove the program in the control panel, add remove programs, I would like to...
1
by: flamkuavos | last post by:
function NextButtonClick (...) begin if CurPageID = TestPage.ID then begin if(choose the "uninstall" Radio) ?...? ????????????? {{uninstallexe} doesnot work here} ... end else begin...
3
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post by:
Hi anyone, I have installed a winforms application vs 2005. It appears in Control Panel -Add / Remove Programs. I have another application .NET and I want uninstall the application installed...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.