Following sample code can be used to get RegisteryKey value based on keyPath and KeyName public static String GetRegistryValue( String regKeyPath, String regKeyName) { // Create value variable string regValue = null ; try { // Opening the registry key RegistryKey rk = Registry .LocalMachine; // Open a subKey as read-only RegistryKey regKey = rk.OpenSubKey(regKeyPath, RegistryKeyPermissionCheck .ReadSubTree, System.Security.AccessControl. RegistryRights .FullControl); // If the RegistrySubKey does exist if (regKey != null ) { // If the RegistryKey exists get its value or null is returned. regValue = ( string )regKey.GetValue(regKeyName.ToUpper()); } return regValue; } catch ( Exception ex) { throw ex; } }