0

I know this question was already there. But either the answer is for 32bit(as I used) or suggesting "Access/Modify Registry". I failed in the first option. Second option is not good for me. I myself don't know about the testing machine and registry entries vary for 32 bit and 64 bit. I am trying to list out all the apps installed and uninstall the specified one(ruby). I used wmi class with the query

ManagementObjectSearcher managementObjectSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Product");

But, it does not returns all the applications. The "ruby" is missing but it shown in the Control Panel\Programs\Programs and Features as below. Can anybody say how to access all the installed programs irrespective of their bit(32/64)?

Note: I am using VS2010, .Net 4.0, C#, Windows 7 Enterprise Edition.

enter image description here

prabhakaran
  • 5,126
  • 17
  • 71
  • 107
  • check [link](http://stackoverflow.com/questions/15524161/c-how-to-get-installing-programs-exactly-like-in-control-panel-programs-and-fe) – Ganesh May 08 '14 at 12:49
  • @Ganesh The link also deals with "Registry". Registry locations will differ from one machine to another or from one OS to another. – prabhakaran May 09 '14 at 05:10
  • I have all the code to access software installed per user or per computer from the registry in an old project of mine: http://sourceforge.net/p/win32iam/code/HEAD/tree/trunk/BlackFox.UninstallInformations/Informations.cs – Julien Roncaglia May 09 '14 at 10:53
  • @Downvoter Please dont make silent downvote. You are making a downvote at the cost of your 1 credit. So, when you make the downvote mention the point. Without the point, for you it is credit lose, for me I am also losing credit without knowing the cause. – prabhakaran May 09 '14 at 11:21

1 Answers1

2

There is not really any such thing as "All the installed programs".

A program could be:

  • A simple executable file on the desktop.
  • A collection of executable and DLL files which co-operate together. Usually these will be in Program Files.
  • A DLL registered as an add-in or shell extension
  • something else

So "A Program" is not a single thing which can be conclusively identified.

Installation could be:

  • Installed with Windows Installer. You can get a list of these using the Installer API.
  • Installed with another setup program which does't use Windows Installer, but just places the files where it wants them. They usually supply an uninstaller of their own. THese are often recorded in the Registry for the Add/Remove programs tool.
  • Just unzipped into a folder. These may not be recorded anywhere in the registry, they are just files in folders. Maybe they put an "uninstall" shortcut on the desktop or in the start menu, or maybe not.

So "installation" is not a simple thing which can be conclusively identified.

Ben
  • 34,935
  • 6
  • 74
  • 113
  • Can you tell me how to retrieve all those things except "Just unzipped into folder". No need of code. Just tell me where to find. – prabhakaran May 09 '14 at 08:58
  • @prabhakaran, just do it like in this answer: http://stackoverflow.com/questions/15524161/c-how-to-get-installing-programs-exactly-like-in-control-panel-programs-and-fe – Ben May 09 '14 at 09:49
  • Aha.. Again registry. People will test my program in any machine. It will be a install -> test -> uninstall thing. So, I myself dont know the test machine. They may test this even using VM. So, I need a solution through .Net functions. Registry approach is not a reliable. – prabhakaran May 09 '14 at 10:08
  • @prabhakaran, my point is this: Programs are not a thing which can be conclusively identified. Installation is not a thing which can be conclusively identified. Therefore ***no solution is reliable***. The combination of WMI `Win32_Product` for Windows Installer, together with registry for other setup programs, is as good as you can do. – Ben May 09 '14 at 10:47