Credential Manager Access Via PS

less than 1 minute read


So I have been getting a lot of Outlook credential issues lately so I thought I would post this as a reference for using PS with the Windows Credential Manager.

To Resolve:

  1. To launch from a run command: control /name microsoft.credentialmanager

  2. To Clear Completely:

cmd /c "cmdkey /list" | ForEach-Object {if ($_ -like "*Target:*")
cmdkey /del:($_ -replace " ", "" -replace "Target:", "")
  1. To add via script:
#Requires v5

Install-Module -Name CredentialManager

$a = get-storedcredential -type generic -ascredentialobject
Remove-StoredCredential -Type generic -Target
New-StoredCredential -Type generic -Target -UserName -Password Pa$$word -Persist Enterprise
  1. You can read up on cmdkey.exe if needed, but I’m trying to move more towards the PS methods. Ex:
cmdkey / /user:user /pass:pass