Clear All Generic Credentials from Credential Manager


for /F "tokens=1,2 delims= " %G in ('cmdkey /list ^| findstr Target') do  cmdkey /delete %H

in PS:

[Windows.Security.Credentials.PasswordVault, Windows.Security.Credentials, ContentType = WindowsRuntime]
$pv = [Windows.Security.Credentials.PasswordVault]::new()
$pv.RetrieveAll()| 
    Select Username -Unique |
    ForEach-Object{
        $pv.FindAllByUserName($_.UserName)
    } |
    ForEach-Object{
        $pv.Remove($_)
    }

Leave a Reply