title: Visual Basic Registry As Admin Writing Keys To Wrong User
body: <p>I am trying to use Visual Basic to write keys to a user registry. The program needs to be run as administrator so when the admin account is used for UAC on the non-admin account to run, the program writes the registry on that admin users profile and not the user whose account the application is running on.        </p>
  
  <p>I have tried the code below, which writes the value for the key in the current user's software path. </p>
  
  <pre><code>My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\AppFolder", "Key", "value")
  </code></pre>
  
  <p>However, when I naviagate to that path (HKEY_CURRENT_USER\Software) on the users profile after execution, that key is not there. However, when I log onto the local admin account that path (HKEY_CURRENT_USER\Software\AppFolder) is present.</p>