CMDKEY.exe (Windows 2003+)

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

Key:
   /add            Add a user name and password to the list.

   TargetName      The computer or domain name that this entry will be associated with.

   /generic        Add generic credentials to the list (used by RDC).

   /smartcard      Retrieve the credential from a smart card.

   /user:UserName  The user or account name to store with this entry.
                   If UserName is not supplied, it will be requested.

   /pass:Password  The password to store with this entry. If Password is not supplied, it will be requested.

   /delete:        Delete a user name and password from the list.
                   If TargetName is specified, that entry will be deleted.
                   If /ras is specified, the stored remote access entry will be deleted.

   /list           Display the list of stored user names and credentials.
                   If TargetName is not specified, all stored user names and credentials will be listed.

The credentials created by CMDKEY can also be created and edited in the GUI Control Panel | Credential Manager

Credentials setup as type /generic:TERMSRV will be used by Remote Desktop Connection, so you will be able to connect as the given user without being prompted for a password. If the password is changed you will need to update the stored credential.

By default the credentials are stored in C:\users\username\AppData\Roaming\Microsoft\Credentials\
(around 400 bytes per credential)

If more than one smart card is found, cmdkey will prompt the user to specify which one to use.
Once stored, passwords are not displayed by cmdkey.

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

“The stupid neither forgive nor forget, the naive forgive and forget, the wise forgive but do not forget” ~ Thomas Szasz (The second sin)

Related:

CIPHER - Encrypt or Decrypt files/folders


© Copyright SS64.com 1999-2015
Some rights reserved