Solved

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

Posted on 2014-11-27
5
484 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
Comment Utility
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
Comment Utility
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
Comment Utility
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 78

Assisted Solution

by:David Johnson, CD, MVP
David Johnson, CD, MVP earned 250 total points
Comment Utility
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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now