title: Powershell: Can't update a registry path because it doesn't exist (but it actually exists)
body: <p>We are running Coded UI tests on IE in Windows 8.1, and we're doing it through Visual Studio Team Services.  As part of our build, we run a Powershell script that disables the popup manager.  The code we use to disable it is this:</p>
  
  <pre><code>Remove-ItemProperty "HKCU:\Software\Microsoft\Internet Explorer\New Windows" -Name "PopupMgr"
  New-ItemProperty "HKCU:\Software\Microsoft\Internet Explorer\New Windows" -Name "PopupMgr" -Value 00000000 -PropertyType "DWord"
  </code></pre>
  
  <p>When I create and deploy a build in Release Manager, running this generates the following error:</p>
  
  <blockquote>
    <p>The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: <strong>Cannot find path 'HKCU:\Software\Microsoft\Internet Explorer\New Windows' because it does not exist.</strong></p>
  </blockquote>
  
  <p>(Emphasis mine)</p>
  
  <p>I've logged onto the VM and looked at the registry, and <code>HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\New Windows</code> absolutely exists.  The only thing I can think of is that its value isn't a DWORD but rather a string -- the <code>PopupMgr</code> key has a Data value of "yes" rather than 1 or 0.  But that doesn't match the error message -- the error says it can't even find the path of the key, not that the value type is a mismatch.  Plus, the code removes the existing key before inserting a new one, so I don't even know how it would notice the mismatch.</p>
  
  <p>Even weirder, if I open Powershell inside the VM and run those exact two lines (I copied and pasted to avoid typos), they ran just fine.</p>
  
  <p>This script worked on Windows 10 perfectly and has for a while, so I'm unsure what's going on here.  The user is a member of the Administrators group, so I don't think it's a permissions issue.</p>
  
  <p>Can anyone shed some light on this?</p>