Delete Entry in Credential Store via Script

We are in a situation where we need to delete an entry in each users Credential Store.

The entry is: (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.
Kasper KatzmannSeniorkonsulentAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Kasper KatzmannSeniorkonsulentAuthor Commented:
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows OS

From novice to tech pro — start learning today.