title: Can't query windows 7 registry remotely using WMI
body: <p>I used following VB script to query a registry value remotely using WMI. It was able to connect, but couldn't get the value. </p>
  
  <pre><code>Option Explicit
  
  Dim strComputer
  Dim strUser, strPassword
  Dim objSWbemLocator, objSWbemServices, objReg
  Dim strKeyPath, strEntryName, strValue
  
  Const HKEY_LOCAL_MACHINE = &amp;H80000002
  
  strComputer = "192.168.1.10"
  
  strUser = "username"
  strPassword = "password"
  
  Set objSWbemLocator = CreateObject("wbemScripting.SwbemLocator")
  Set objSWbemServices = objSWbemLocator.ConnectServer _
  (strComputer, "root\default", strUser, strPassword)
  
  Set objReg = objSWbemServices.Get("StdRegProv")
  
  strKeyPath = "SYSTEM\CurrentControlSet\services\eventlog\Application"
  strEntryName = "MaxSize"
  objReg.GetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strEntryName, dwValue
  Wscript.Echo dwValue
  </code></pre>
  
  <p>It returns: Microsoft VBscript runtime error: Variable is undefined: 'dwValue'. It means that it didn't get the value for target machine. I checked on target machine, the dword value does exist. </p>
  
  <p>I configured the target machine as follows</p>
  
  <ol>
  <li>Turned off firewall</li>
  <li>Run "wmimgmt.msc" -> WMI control -> properties
          enabled "remote enable" for all namespaces and its sub namespaces for all users.</li>
  <li>Started service "Remote registry"</li>
  </ol>
  
  <p>I spent days on this problem and just couldn't figure it out. Please help me check whether the script has problem or it's the configuration of target machine. Thank you very much.</p>