I have a software build and deployment service installed on a computer. The service has been setup to run as the SYSTEM account.

Since the service deploys to a number of other machines and requires the passwords of the machines to connect, I would like cache the credentials for the remote machines using the Windows credential manager.

How do I achieve this when the target account is the SYSTEM account?

I would like a solution that does not require me to download any third party tools and works using the default Windows 10 architecture.

Web searches for the problem came up with results on how to clear the credentials for other accounts.


Use the built-in utility cmdkey to add the credentials.

Download and use the Microsoft Sysinternals utility PsExec: psexec -s to run a cmdkey as SYSTEM. Technically, it's Microsoft, therefore not third-party.

CMDKEY.exe Create, list or delete stored user names, passwords or credentials.

      cmdkey [{/add:TargetName|/generic:TargetName}]
         {/smartcard|/user:UserName [/pass:Password]}


Display a list of stored user names and credentials:
cmdkey /list

Add a generic TERMSRV credential for user PeteZ (on domain dom64) to access the computer Server64:
cmdkey /generic:TERMSRV/Server64 /user:dom64\PeteZ /pass:p4g67hjyy23

Delete the stored TERMSRV credential for Server64:
cmdkey /delete TERMSRV/Server64

Add a user name and password for user Kate to access computer Server64 with the password z5rd63hGtjH7:
cmdkey /add:server64 /user:Kate /pass:z5rd63hGtjH7

Add a user name for user Kate to access computer Server64 and prompt for a password whenever Server64 is accessed:
cmdkey /add:server64 /user:Kate

Delete the stored credential for Server64:
cmdkey /delete:Server64

  • I just found a similar answer here as well! security.stackexchange.com/a/110742/39741 However, I would have to run the program as the SYSTEM user before it would work right? – Dodzi Dzakuma May 5 '17 at 18:12
  • 1
    I tried it and it partially work in Windows 10. It asks for the password every time I use the batch script. Do you have any idea how do I make it work without promptly being asked for the password. – Varun Jain Sep 5 '19 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.