title: Remove an entry from credential manager for all users on Windows
body: <p>I am currently implementing a "remove settings" for all users in a Windows uninstaller and came over an issue I am not even sure is possible to solve.</p>
  
  <p>The application stores credential entries for the current user using the CredentialManager (<code>keymgr.dll</code>). Let's call the target of the credential "X". On uninstall all credentials with stored with target "X" should be removed on all users. The uninstaller of course requires administrator privileges but still I find it very difficult to accomplish this.</p>
  
  <p>For the current user that command is generally solved via <code>cmdkey /delete=:X</code> from a command prompt. As far as I know <code>cmdkey.exe /list</code> only helps to list entries for the current user and can't remove local entries from another user. </p>
  
  <p>I have learned that the credentials are stored as OS files under the <code>C:\Users\_user_\AppData\Local\Microsoft\Credentials</code> folder, but I can't know which files are the entries I want to delete and removing all would be dangerous for other applications. Also I assume removing OS files will be dangerous and could have limitations (extra UAC prompt?) as well.</p>
  
  <p><code>Runas</code> command is the closest shot I got but because it requires the password of the user it becomes very difficult and not something I would want in the uninstaller. I also would need a way to get the username and domain for each user and iterate them.</p>
  
  <p>I would prefer to use either <code>cmd</code> or <code>powershell</code> for this.</p>