Solved

C# get a list of programs instatlled on a remote machine (Add/Remove Programs)?

Posted on 2014-11-27
5
559 Views
Last Modified: 2014-12-27
Hi,

I am looking at a good way I can interrogate remote machines to work out what software is installed
in Add/Remove programs via C#.

The issue is the various methods return different results.

Some people say don't use Win32_product. Some were saying this is bad for performance.

However the other methods don't seem to return the correct count.

Here are some interesting results....

Add/Remove control panel applet            - 108 programs installed

Now compare this to the various methods:

select * from win32_product                - 186 items.
select * from Win32reg_AddRemovePrograms   - 71 objects.
select * from Win32Reg_AddRemovePrograms64 - 71 objects.

So why is there such a variance - I would of thought they should be *exactly* the same if not
close.

What are other peoples thought on the best method?
Why such a variance?
If I don't mind a performance hit is there anything wrong with using Win32_product?

Thanks,

Ward.
0
Comment
Question by:whorsfall
  • 3
5 Comments
 
LVL 35

Expert Comment

by:Kimputer
ID: 40470263
Win32_product shows only MSI installer products. Software using their own installer won't show.
Try to list it with an internal process and capture the output of
wmic product list brief
0
 

Author Comment

by:whorsfall
ID: 40470270
Hi,

Thanks for your response.

Can you clarify what you mean when you say:

Try to list it with an internal process and capture the output of
 wmic product list brief

So are u saying I should be capturing the output of:
 wmic product list brief

Thanks,
Ward.
0
 
LVL 35

Expert Comment

by:Kimputer
ID: 40470280
Yes, in VB it's like this:

Dim p As ProcessStartInfo = New System.Diagnostics.ProcessStartInfo("wmic", "product list brief")

You can probably easily translate this to C#, and then capture the output (each line is a software product, only the name)? That's all.
0
 
LVL 79

Assisted Solution

by:David Johnson, CD, MVP
David Johnson, CD, MVP earned 250 total points
ID: 40471013
select * from win32_product  is extremely slow because it does a consistency check of the installed .msi packages.
http://csi-windows.com/toolkit/288-win32product-wmi-class-replacement

Query the registry is lightning fast (example given is vb but it is simple to convert to c#
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
http://support.microsoft.com/kb/821775
0
 
LVL 35

Accepted Solution

by:
Kimputer earned 250 total points
ID: 40473274
I would contend that HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall is probably not sufficient in this current day and age.
Enumerate this as well (64 bits OS):
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question