473,396 Members | 1,933 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to programmatically check for versions of software

What are some good ways to programmatically check for software already
installed on a computer?

For example, to check a version of Internet Explorer, a program can check
the registry for the following value:
[HKLM\SOFTWARE\Microsoft\Internet Explorer] Version, and see if the version
is 6.0 or not.

However, not all installed software can be checked as easily. For example,
Windows Media Player 9 has the following registry path:
[HKLM\SOFTWARE\Microsoft\MediaPlayer\9.0\Registrati on] UDBVersion, which one
can use to see which version of WMP9 is installed. However, when version 10
does come out, one does not really know if it will use the same pattern for
registry path.

The biggest problem, perhaps, is that registry paths remain in the registry
even after a program is uninstalled. For example, one may want to check if
a program is installed simply by checking for the existence of a registry
path. But sometimes, uninstalling a program WILL NOT remove the registry
entries, and so, the program will incorrectly believe the software is
already installed.

Maybe my approach is wrong. Perhaps relying on the registry is not 100%
proof. Please suggest better ways for programmatically checking for
versions of software installed on a computer. Thanks.

Nov 16 '05 #1
2 8099
Jak Sparrow wrote:
What are some good ways to programmatically check for software already
installed on a computer?

For example, to check a version of Internet Explorer, a program can check
the registry for the following value:
[HKLM\SOFTWARE\Microsoft\Internet Explorer] Version, and see if the version
is 6.0 or not.

However, not all installed software can be checked as easily. For example,
Windows Media Player 9 has the following registry path:
[HKLM\SOFTWARE\Microsoft\MediaPlayer\9.0\Registrati on] UDBVersion, which one
can use to see which version of WMP9 is installed. However, when version 10
does come out, one does not really know if it will use the same pattern for
registry path.

The biggest problem, perhaps, is that registry paths remain in the registry
even after a program is uninstalled. For example, one may want to check if
a program is installed simply by checking for the existence of a registry
path. But sometimes, uninstalling a program WILL NOT remove the registry
entries, and so, the program will incorrectly believe the software is
already installed.

Maybe my approach is wrong. Perhaps relying on the registry is not 100%
proof. Please suggest better ways for programmatically checking for
versions of software installed on a computer. Thanks.


If you look at the file properties in Windows Explorer, you will see
that each file has a version attribute attached to it.

So

(a) Find the actual executable
(b) Use the File or FileInfo class to read the version attribute.
Nov 16 '05 #2
Hi Jak,

"Jak Sparrow" <no@spam.net> wrote in message
news:up**************@TK2MSFTNGP11.phx.gbl...
What are some good ways to programmatically check for software already
installed on a computer?

<snip>

WMI (System.Management namespace) is a good tool for this sort of task.
Just to give you an idea:

...
// need a "using System.Management;" somewhere
// and a reference to System.Management.dll
static void ListAllProducts()
{
SelectQuery allProductsQuery = new SelectQuery("Win32_Product");

ManagementObjectSearcher allProducts =
new ManagementObjectSearcher(allProductsQuery);

foreach(ManagementObject product in allProducts.Get())
{
Console.WriteLine("Product {0} is at version {1}",
product.Properties["Name"].Value,
product.Properties["Version"].Value);
}
}
...

Regards,
Daniel
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Oliver Elphick | last post by:
The attached proposal is written primarily for Debian. Its motivation is that the current package upgrade process is pretty flaky and also that the current packaging does not really provide for...
2
by: Atul | last post by:
Hi, How can I "disable script debugger" programmatically using C#? Its similar action when we check the check box from IE (Tools | Internet Options...| Advanced). Any ideas??? Thanks Atul
13
by: Alexandra | last post by:
Hi, I have a hidden system file that I need to read. I am logged in as an administrator. I can not change the file attributes using the windows explorer.
2
by: Bhupesh Naik | last post by:
This is a query regarding my problem to make a spell and grammar check possible in text area of a web page. We have aspx pages which are used to construct letters. The browser based screens...
6
by: Matt Frame | last post by:
I have a client that has asked us to get a digital signature certificate and start digitally signing all files we pass between each other. I have heard of the subject and know about the certs but...
4
by: Maxwell2006 | last post by:
Hi, I am struggling with making my website compatible with multiple browsers and versions. Is there any tool that shows me how my pages look like in different browsers
3
by: Ken Fine | last post by:
I'm interested in programmatically manipulating groups of ASP.NET controls by type. Can someone suggest code for the following? Loop through, say, all label controls on a page, and assigning a...
8
by: Chandra | last post by:
How do I programmatically (javascript) check if link is valid in html?
4
by: pwu | last post by:
Hi, I am doing an automated scan of a large number of UNIX machines which can be Solaris, AIX or HPUX. I want to find out for a machine via a script if: 1) DB2 is installed? 2) If installed...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.