title: How to read the (Default) value from registry in VBScript?
body: <p>in the registry ther is a key, which has only value, the <code>(Default)</code> value. This default entry has a value what i need. I found a script to read the registry values.</p>
  
  <pre><code>const HKEY_LOCAL_MACHINE = &amp;H80000002
  const RegistryLocation   = "SOFTWARE\SAP BusinessObjects\Suite XI 4.0\Xcelsius\Keycodes"
  
  ReadRegistry( RegistryLocation )
  
  Function ReadRegistry( RegistryLocation )
  
  strComputer = "."
  
  Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &amp; strComputer &amp; "\root\default:StdRegProv")
  
  oReg.EnumValues HKEY_LOCAL_MACHINE, RegistryLocation, arrValueNames, arrValueTypes
  
      Wscript.Echo "Key Name: " &amp; arrValueNames(0)
  'RegKeyName = arrValueNames(0)
  
  oReg.GetStringValue HKEY_LOCAL_MACHINE, RegistryLocation, arrValueNames(0), strValue
  Wscript.Echo "Value: " &amp; strValue
  'RegKeyValue = strValue
  
  'ChangeRegistryValue RegistryLocation, arrValueNames(i), NewSerial
  
  End Function 'ReadRegistry
  </code></pre>
  
  <p>It works fine IF there are more keys. If only the (Default) value exists, i get a type mismatch error. If i create a new key, then i can read the default entry value.</p>
  
  <p>So my question is, what i am doing wrong, and how should i do it?</p>
  
  <p>Thanks!</p>