Verify .Net Version ‘Updates’ installed on any Machine

Sometimes we need to verify what all updates for .Net version exist on my computer. This is required because fixes of known issues are put in by Microsoft in these.

 

We have 2 ways to see these updates list:

a) Looking into the registry (Manual)

b) programmatic identify and list them

The Path to look these in Registry is  HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Updates

Dotnet Version Updates

Under this you will find .Net Version folders and under each such folders you will find subfolders one each for Updates name <KBXXXXXXX>…

 

You can also list these updates using a C# program:

using System;
using Microsoft.Win32;

public class GetUpdateHistory
{
public static void Main()
{
using (RegistryKey baseKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey(@”SOFTWARE\Microsoft\Updates”))
{
foreach (string baseKeyName in baseKey.GetSubKeyNames())
{
if (baseKeyName.Contains(“.NET Framework”) || baseKeyName.StartsWith(“KB”) || baseKeyName.Contains(“.NETFramework”))
{

using (RegistryKey updateKey = baseKey.OpenSubKey(baseKeyName))
{
string name = (string)updateKey.GetValue(“PackageName”, “”);
Console.WriteLine(baseKeyName + ” ” + name);
foreach (string kbKeyName in updateKey.GetSubKeyNames())
{
using (RegistryKey kbKey = updateKey.OpenSubKey(kbKeyName))
{
name = (string)kbKey.GetValue(“PackageName”, “”);
Console.WriteLine(” ” + kbKeyName + ” ” + name);

if (kbKey.SubKeyCount > 0)
{
foreach (string sbKeyName in kbKey.GetSubKeyNames())
{
using (RegistryKey sbSubKey = kbKey.OpenSubKey(sbKeyName))
{
name = (string)sbSubKey.GetValue(“PackageName”, “”);
if (name == “”)
name = (string)sbSubKey.GetValue(“Description”, “”);
Console.WriteLine(” ” + sbKeyName + ” ” + name);

}
}
}
}
}
}

}
}
}
}
}

The output of this code would be

Dotnet Version Updates names  by Code

 

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s