How to add cached credentials for the Windows System acount?
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.
Syntax
cmdkey [{/add:TargetName|/generic:TargetName}]
{/smartcard|/user:UserName [/pass:Password]}
[/delete{:TargetName|/ras}]
/list:TargetName
Examples:
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