Skip to content

Instantly share code, notes, and snippets.

@youcandanch
Created October 25, 2012 14:06
Show Gist options
  • Save youcandanch/3952746 to your computer and use it in GitHub Desktop.
Save youcandanch/3952746 to your computer and use it in GitHub Desktop.
Quick console app to get VS2010 product key
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Win32;
namespace RegCheck
{
class Program
{
static void Main(string[] args)
{
RegistryKey visualStudioRegKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\10.0\\Registration\\2000.0x0000");
String VSRegString = visualStudioRegKey.GetValue("PIDKEY").ToString();
var builder = new StringBuilder();
int count = 0;
foreach (var c in VSRegString)
{
builder.Append(c);
if ((++count % 5) == 0)
{
builder.Append('-');
}
}
VSRegString = builder.ToString();
Console.Write("Your Visual Studio Product Key Is: " + VSRegString);
Console.Read();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment