title: RegWrite to HKLM isnt working. Any ideas?
body: <p>Hi overflow community,</p>
  
  <p>I am trying to create a key and a value which will reside in the HKEY_Local_Machine folder.</p>
  
  <p>Every time I try and run the below code I get the error "Invalid Root in registry key". </p>
  
  <pre><code>Dim WshShell, bKey
  Set WshShell = WScript.CreateObject("WScript.Shell")
  
  WshShell.RegWrite "HKLM\SOFTWARE\ACME\FortuneTeller\", 1, "REG_BINARY"
  WshShell.RegWrite "HKLM\SOFTWARE\ACME\FortuneTeller\MindReader", "Goocher!", "REG_SZ"
  
  bKey = WshShell.RegRead("HKLM\SOFTWARE\ACME\FortuneTeller\")
  WScript.Echo WshShell.RegRead("HKLM\SOFTWARE\ACME\FortuneTeller\MindReader")
  </code></pre>
  
  <p>The above will work if I want to create within the HKCU folder. </p>
  
  <p>Does anyone know why I get an error when I try and change the location from HKCU to HKLM? </p>
  
  <p>Or could someone give a brief example to writing a reg value to the HKLM?</p>
  
  <p>Thankyou</p>