Delete Entry in Credential Store via Script

Posted on 2013-08-28
Medium Priority
Last Modified: 2013-08-28
We are in a situation where we need to delete an entry in each users Credential Store.

The entry is: MS.Outlook:UserName@domain.com:PUT (LegacyGeneric)
(LegacyGeneric) is not always present.

The clients are a mix of Win XP, 7 and 8 (only some few Win 8 machines)

I've tried to look at powershell, but couldn't find any suitable  solution.
It must be done via login script.

Any help is appreciated.
Question by:Kasper Katzmann
LVL 86

Accepted Solution

oBdA earned 2000 total points
ID: 39445059
The command line tool for this is named cmdkey.exe. Try the following batch script; it's currently in test mode and will only display the "delete" commands it would normally run. Remove the uppercase ECHO in line 6 to run it for real. If it doesn't do what it should, please open a command prompt and provide a sample output of the following command: cmdkey.exe /list.
@echo off
set Filter=MS.Outlook:
for /f "tokens=1*" %%a in ('cmdkey.exe /list ^| find /i "%Filter%"') do (
	echo Removing credentials for target '%%~b'
	ECHO cmdkey.exe /delete:"%%~b"

Open in new window


Author Closing Comment

by:Kasper Katzmann
ID: 39446431
Yep, that's it. Unsure if it also deletes MS.Outlook entries that shouldn't be deleted. But we will test it tomorrow.

Thank's for helping me out here.

Featured Post

Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Dropbox has a relatively new feature called Smart Sync.  This feature allows Dropbox Professional (not plus) and Dropbox Business (if enabled) users to store information in Dropbox WITHOUT storing any files on their computer.
A simple method to resolve a "keyboard not working" problem by modifying the Windows registry. This issue can often be encountered after using the VMware vCenter Converter Standalone Agent to perform a Physical-to-Virtual (P2V) conversion process.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Loops Section Overview

600 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question