Solved

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

Posted on 2014-11-27
5
515 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 78

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C# application error "Parameter Is Not Valid". 3 79
Problem of RegEx to match the first occurence of 10 35
Error when loading the database 16 55
C# parent child form 5 14
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…
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 …

914 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

17 Experts available now in Live!

Get 1:1 Help Now