473,327 Members | 2,012 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,327 software developers and data experts.

Determine installed version of software

Tim
I want to write a generic method to read the installed version of
software based on the exact software name that is displayed in Add /
Remove programs. Is there a way to do this using C#? I found a
method which will return all the installed software using this
registry key "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninsta ll\"
and using System.Management. I'm assuming I can use the same to get
what I need?

Thank you in advance for any help.

TK.
Jan 17 '08 #1
2 6561
Tim wrote:
I want to write a generic method to read the installed version of
software based on the exact software name that is displayed in Add /
Remove programs. Is there a way to do this using C#? I found a
method which will return all the installed software using this
registry key "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninsta ll\"
and using System.Management. I'm assuming I can use the same to get
what I need?

Thank you in advance for any help.

TK.
Some examples of what you are seeing and what you want to do would
probably go a long way of helping us help you here.

--
Lasse Vågsæther Karlsen
mailto:la***@vkarlsen.no
http://presentationmode.blogspot.com/
PGP KeyID: 0xBCDEA2E3
Jan 17 '08 #2
Tim
I found a potential solution after a few hours of Google searching.
The code goes through the entire installed apps section in the
registery uninstall section. The apps I'm looking for are displayed
by their product code in InstallShield. I can pass in a string of the
exact app name and it will work even for those that are displayed by
product name using the displayName variable below. Hope this helps
anyone else looking for this type of a solution.

Again, it needs to be tweaked slightly to pass in the app I'm looking
for return the string of the version that I looked for. But it
appears to work. Hopefully I'll meet my deadline:

//Get all installed apps and version numbers
public void GetInstalledApps()
{
string uninstallKey = (@"SOFTWARE\Microsoft\Windows
\CurrentVersion\Uninstall");
string junk = "";
string Version = @"SOFTWARE\Microsoft\Windows
\CurrentVersion\Uninstall";
using (RegistryKey rk =
Registry.LocalMachine.OpenSubKey(uninstallKey))
using (RegistryKey rv =
Registry.LocalMachine.OpenSubKey(Version))
{
string[] skNames = rk.GetSubKeyNames();
int skNamesLen = skNames.Length;
string skName = null;

string[] svNames = rv.GetSubKeyNames();
int svNamesLen = svNames.Length;
string svName = null;

for (int namesIdx = 0; namesIdx < skNamesLen; namesIdx+
+)//
// foreach (string skName in rk.GetSubKeyNames())
{
skName = skNames[namesIdx];
svName = svNames[namesIdx];

using (RegistryKey sk = rk.OpenSubKey(skName))
{
sk.Name.Replace(uninstallKey, ""); //Root
object displayVersion = null, displayName =
null;

using (RegistryKey sv = rv.OpenSubKey(svName))
{
displayVersion =
sv.GetValue("DisplayVersion");
displayName = sv.GetValue("DisplayName");
if (displayVersion != null && displayName !
= null)
{
//displayValue = (+
+counter).ToString();
//TreeNode node = new
TreeNode(displayValue.ToString());
junk = displayVersion.ToString();
junk = displayName.ToString();
//nd1.Nodes.Add(node);
}
}
}
}
}
}

TK.
Jan 17 '08 #3

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

Similar topics

1
by: michael newport | last post by:
I have installed php-4.3.3RC1 on Suse 8.2, and everything went fine even the make install, but I do not see the new version in yast2 software packages, it still has the old version 4.3.1 any...
11
by: Barry G. Sumpter | last post by:
Can get VS.Net to execute properly. I'm not the only one having this prob. The registry deletions don't work for me. Any users of MVPs have a solution for this?
9
by: Michael A. Covington | last post by:
What is the best way to test whether .NET 1.1 is installed on someone's machine? I'd like to give him a small program to run to test this, and based on the answer, he'll download either the big...
1
by: Tarren | last post by:
I have to write an auto patcher for all of the client pcs, but some are running different versions of office. How can I determine which version of Microsoft Office is installed? Do I get it...
3
by: george.e.sullivan | last post by:
Hello all, I have three tables Employess, Equipment, and Software. I have tried without success to figure out how to show a single Equipment Serial Number show all the software installed on that...
3
by: balakrishnan.dinesh | last post by:
hi frnds How to determine the version of the MSXML installed on a computer and How to determine the version of the MSXML used by Internet Explorer through javascript code. Can anyone say me ,...
1
by: Leonid Lastovkin | last post by:
I would like to be able to find out which version of Microsoft Office is installed on the host computer. How can I implement this query in C#? I do not need the whole program, but a relevant code...
7
by: cj2 | last post by:
I'm trying to access VFP 8 tables from VB 2008. How can I determine the version of the VFP OLEDB driver on my PC? What is the latest version?
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.