Add credentials to Windows Credential Manager

Typically I’ll add credentials through a Powershell script with cmdkey however when trying to use cmdkey via Automox the response in the activity logs is “CMDKEY: Credential added successfully. CMDKEY: Credential added successfully.” yet the credentials are not added when checking on the device.

I’m using exit 1 as for evaluation code and cmdkey /add:Server1 /user:Domain\User /pass:pass for the remediation code.

Any thoughts?

The typical issue with worklets is that they run as System, rather than the currently logged in user. Would that interfere with what cmdkey is trying to do?

Also be careful of sending any credentials through a worklet, as that code gets stored not just in the console, but also in the Automox log file on the local machine (in plain text).

I’m not sure. I may need to look into other options via other Powershell options.

Good to know that the code gets stored in plain text on the local machine log file. I’ll have to figure out a way to encrypt and decrypt with this method.

Thanks Nic

I looked at the cmdkey documentation more closely and it looks like the command stores credentials for the currently logged in user, which in the case of a worklet is System. You could log in as another user but that would also require putting more credentials in the worklet and it would be different for each machine that you’re running the worklet on.