Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2014-11-27
5
585 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 80

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

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!
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

789 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