Credential Manager Access Via PS
Description:
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:
-
To launch from a run command: control /name microsoft.credentialmanager
-
To Clear Completely:
1 2 3 4
cmd /c "cmdkey /list" | ForEach-Object {if ($_ -like "*Target:*") { cmdkey /del:($_ -replace " ", "" -replace "Target:", "") }}
-
To add via script:
1 2 3 4 5 6 7 8 9 10 11
#Requires v5 Install-Module -Name CredentialManager #Get-StoredCredential #New-StoredCredential #Remove-StoredCredential #Get-StrongPassword $a = get-storedcredential -type generic -ascredentialobject Remove-StoredCredential -Type generic -Target LegacyGeneric:target=MicrosoftOffice16_Data:SSPI:example@domain.com New-StoredCredential -Type generic -Target MicrosoftOffice16_Data:SSPI:example@domain.com -UserName example@domain.com -Password Pa$$word -Persist Enterprise
-
You can read up on cmdkey.exe if needed, but I’m trying to move more towards the PS methods. Ex:
1
cmdkey /generic:MS.Outlook:username@domain.com:PUT /user:user /pass:pass
Comments