Connecting Tech Pros Worldwide Help | Site Map

Programmatically uninstall a program?

  #1  
Old November 15th, 2005, 11:04 PM
Bryan
Guest
 
Posts: n/a
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


  #2  
Old November 15th, 2005, 11:04 PM
Peter Rilling
Guest
 
Posts: n/a

re: Programmatically uninstall a program?


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" <bryansp_msX@hotmailX.comX> wrote in message
news:#OB3syiAEHA.1464@tk2msftngp13.phx.gbl...[color=blue]
> 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[/color]
the[color=blue]
> Control Panel) and uninstall it.
> Is there a way to do this?.. Thanks for any help... Bryan
>
>[/color]


  #3  
Old November 15th, 2005, 11:04 PM
Bryan
Guest
 
Posts: n/a

re: Programmatically uninstall a program?


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" <peter@nospam.rilling.net> wrote in message
news:eFLHA9iAEHA.2036@TK2MSFTNGP12.phx.gbl...[color=blue]
> All this information is stored in the registry. You can take a look at[/color]
the[color=blue]
> registry key LocalMachine/Software/Installer/Products. There might be a
> better way though.
>
> "Bryan" <bryansp_msX@hotmailX.comX> wrote in message
> news:#OB3syiAEHA.1464@tk2msftngp13.phx.gbl...[color=green]
> > 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[/color]
> the[color=green]
> > Control Panel) and uninstall it.
> > Is there a way to do this?.. Thanks for any help... Bryan
> >
> >[/color]
>
>[/color]


  #4  
Old November 15th, 2005, 11:04 PM
Jason Newell
Guest
 
Posts: n/a

re: Programmatically uninstall a program?


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" <bryansp_msX@hotmailX.comX> wrote in message
news:%23OB3syiAEHA.1464@tk2msftngp13.phx.gbl...[color=blue]
> 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[/color]
the[color=blue]
> Control Panel) and uninstall it.
> Is there a way to do this?.. Thanks for any help... Bryan
>
>[/color]


  #5  
Old November 15th, 2005, 11:05 PM
C P
Guest
 
Posts: n/a

re: Programmatically uninstall a program?


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" <nospam@nospam.com> wrote in message
news:eg5OtTjAEHA.3456@TK2MSFTNGP09.phx.gbl...[color=blue]
> 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[/color]
command[color=blue]
> line or programmatically. I have pasted an example below. I use Windows[/color]
XP[color=blue]
> Professional, so the key path may vary. HTH
>
>[/color]
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curr entVersion\Installer\UserD[color=blue]
> ata\S-1-5-18\Products\9040110900063D11C8EF10054038389C\Insta llProperties
> DisplayName: Microsoft Office Professional Edition 2003
> UninstallString: MsiExec.exe /I{90110409-6000-11D3-8CFE-0150048383C9}[/color]
<-[color=blue]
> You can execute this from the command line.
>
> --
> Jason Newell
> Software Engineer
> The Charles Machine Works, Inc.
>
>
> "Bryan" <bryansp_msX@hotmailX.comX> wrote in message
> news:%23OB3syiAEHA.1464@tk2msftngp13.phx.gbl...[color=green]
> > 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[/color]
> the[color=green]
> > Control Panel) and uninstall it.
> > Is there a way to do this?.. Thanks for any help... Bryan
> >
> >[/color]
>
>[/color]


  #6  
Old November 15th, 2005, 11:07 PM
Bryan
Guest
 
Posts: n/a

re: Programmatically uninstall a program?


Thanks everyone for your help. I am able to use both techniques to
accomplish my task.

"Bryan" <bryansp_msX@hotmailX.comX> wrote in message
news:%23OB3syiAEHA.1464@tk2msftngp13.phx.gbl...[color=blue]
> 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[/color]
the[color=blue]
> Control Panel) and uninstall it.
> Is there a way to do this?.. Thanks for any help... Bryan
>
>[/color]


Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Uninstall application programmatically =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= answers 3 September 19th, 2008 01:45 PM
Programatically uninstall/install a service. UJ answers 4 January 31st, 2007 04:55 PM
How to Stop Serviced Component so Uninstall removes it completely Robert answers 3 November 22nd, 2005 10:24 PM
How to Stop Serviced Component so Uninstall removes it completely Robert answers 3 August 2nd, 2005 06:35 AM