1

I am working on making a script to clear out all generic credentials in credential manager.

I have a user here who has several hundred generic credentials, deleting them by conventional means is going to be a royal pain. I have googled all over and all the answers are, write a bat file using CMDKEY. Well the problem is, CMDKEY says there are NO credentials found... which makes absolutely no sense when she has several hundred that are visible in credential manager. Is there something I am missing here? I also tried VaultCMD, and that found nothing as well. Is there another command or way to simply clear out the credential manager, a file perhaps stored somewhere that I can erase etc?

Only way I can get CMDKEY to show a generic credential is if I add it from CMDKEY such as cmdkey /generic:testnet /user:test /pass 123

It will display that entry and only that.

user464793
  • 13
  • 1
  • 4
  • Are you signed onto the account which the credentials were saved when you run the command? Also try [`for /F "tokens=1,2 delims= " %G in ('cmdkey /list ^| findstr Target') do cmdkey /delete %H`](https://superuser.com/questions/689456/what-is-the-windows-7-command-line-to-remove-all-remember-passwords-in-credentia).... Furthermore check out: [Clear Cached Credentials/Passwords Stored in Windows Credential Manager](https://gallery.technet.microsoft.com/scriptcenter/Clear-Cached-CredentailsPas-981564bf) – Vomit IT - Chunky Mess Style Apr 10 '18 at 21:57
  • Yes I am signed into the account, I also tested on my own machine by making dummy generic credentials in the GUI credential manager, then seeing if cmdkey /list would bring anything up. Nothing, says no entries. This really is not making any sense, and google search shows no results. I am really at a complete lost here. – user464793 Apr 11 '18 at 14:48
  • Ok so I am a moron, apparently you have to run this command on the local users account and not with an elevated command prompt. Sorry for wasting everyones time! – user464793 Apr 11 '18 at 15:03

1 Answers1

0

Use command line net use * /delete There is also a command-line utility: C:> cmdkey /?

Creates, displays, and deletes stored user names and passwords.

The syntax of this command is:

CMDKEY [{/add | /generic}:targetname {/smartcard | /user:username {/pass{:password}}} | /delete{:targetname | /ras} | /list{:targetname}]

Examples:

To list available credentials: cmdkey /list cmdkey /list:targetname

To create domain credentials: cmdkey /add:targetname /user:username /pass:password cmdkey /add:targetname /user:username /pass cmdkey /add:targetname /user:username cmdkey /add:targetname /smartcard

To create generic credentials: The /add switch may be replaced by /generic to create generic credentials

To delete existing credentials: cmdkey /delete:targetname

To delete RAS credentials: cmdkey /delete /ras

user856343
  • 255
  • 1
  • 3