title: Changing other user's registry through batch files
body: <p>Is it possible to change other user <code>HKCU</code> registry from other admin account?</p>
  
  <p>My workflow is:</p>
  
  <ol>
  <li>Install software on admin account.</li>
  <li>Installation creates user "CustomUser"</li>
  <li>I need to set some registry keys for this user...</li>
  </ol>
  
  <p>I am able to create registry keys in ProfileList through command:</p>
  
  <pre><code>%windir%\System32\runas.exe /profile /user:domain\%targetUser% logonui.exe
  </code></pre>
  
  <p>But this doesn't creates target key in <code>HKEY_USERS</code></p>
  
  <p>I also tried impersonation through C# described in : <a href="http://www.codeproject.com/Articles/124981/A-Complete-Impersonation-Demo-in-C-NET" rel="nofollow">http://www.codeproject.com/Articles/124981/A-Complete-Impersonation-Demo-in-C-NET</a></p>
  
  <p>But this line throws an exception:  <code>Boolean loadSuccess = 
                                  LoadUserProfile(tokenDuplicate, ref profileInfo);</code></p>
  
  <p>Ideal way for me is to change registry just in batch file.</p>