Using Credential Manager On Windows - Ultimate Guide - Windows OS Hub
Using Credential Manager On Windows - Ultimate Guide - Windows OS Hub
Windows Server Active Directory Windows Clients Virtualization PowerShell Exchange Cloud Linux
Windows Credential Manager allows you to securely store credentials (usernames and passwords) used to access
network resources, websites, and apps. You can use the credentials stored in Credential Manager to connect to network Active Directory
resources that support Windows authentication (NTLM or Kerberos), certificate-based authentication, or basic authentication
without entering a password. Group Policies
Exchange Server
Contents:
Microsoft 365
Credential Manager is built into Windows and allows you to securely store the following types of credentials:
Windows Server 2016
Windows Credentials – credentials to access resources that support Windows authentication (NTLM or Kerberos).
PowerShell
This could be credentials for mapping network drives or shared SMB folders, NAS devices, saved passwords for RDP
connections, passwords for sites that support Windows authentication, etc;
VMWare
Windows Credential Manager does not store credentials for automatic login Windows or cached domain
Hyper-V
credentials.
Linux
Certificate-Based Credentials – to access resources using certificates (from the Personal section of the Certificate
MS Office
Manager) and for smart cards;
Generic Credentials – credentials for accessing third-party apps that are compatible with Credential Manager and
support Basic authentication;
RECENT POSTS
Web Credentials – saved passwords in Edge and Internet Explorer browsers, Microsoft apps (MS Office, Teams,
Outlook, Skype, etc.).
Installing Windows 11
without Network and
Internet Connection
April 18, 2024
How to Enable and
Windows Server Active Directory Windows Clients Virtualization PowerShell Exchange Cloud
Configure Linux
Wake-on-LAN
(WoL) in Windows
April 1, 2024
The Credential Manager also stores user passwords that were added with the runas /savecred command and used
As you can see, there are two passwords in the Credential Manager that we saved earlier.
SUBSCRIBE
The saved passwords for the RDP connections are specified in the format TERMSRV\hostname .
Here you can add a saved credential, edit it (you cannot view a saved password in the graphic interface), or delete any of the
entries.
In addition, you can use the classic interface of Stored User Names and Passwords to manage saved credentials on
Windows. Open in with the command below:
rundll32.exe keymgr.dll,KRShowKeyMgr
Windows Server Active Directory Windows Clients Virtualization PowerShell Exchange Cloud Linux
Here you can also manage your saved credentials, and backups or restores of entries in the Credential Manager (this feature
can be used to move the stored credentials database to another computer).
To access a shared folder anonymously, you need to add a guest account without a password to Credential
Manager:
To manage the hypervisor remotely from the Hyper-V Manager console, you must save the Hyper-V administrator
password:
cmdkey /list
cmdkey /delete:FS01
For /F "tokens=1,2 delims= " %G in ('cmdkey /list ^| findstr "target=TERMSRV"') do cmdkey /delete %H
Clear all stored passwords in Credential Manager with the following on-liner:
Windows Server Active Directory Windows Clients Virtualization PowerShell Exchange Cloud Linux
for /F "tokens=1,2 delims= " %G in ('cmdkey /list ^| findstr Target') do cmdkey /delete %H
This command allows you to quickly delete old stored passwords that can cause a user account to be permanently
You can also manage stored credentials with vaultcmd command. List the stored credentials of type Windows Credentials:
vaultcmd /listcreds:"Windows Credentials"
All saved passwords are stored in the secure Windows Vault. You can get the path to the Windows Credentials vault as
follows:
vaultcmd /list
By default, this is %userprofile%\AppData\Local\Microsoft\Vault . The encryption key is stored in the Policy.vpol file.
Passwords in .vcrd files are decrypted using the encryption key.
The VaultSvc service must be running for the Credential Manager to work:
Get-Service VaultSvc
If the service is disabled, you will receive an error when you try to access Credential Manager:
If you want to prevent users from saving network passwords in the Credential Manager, enable the Network access: Do
not allow storage of passwords and credentials for network authentication GPO option under Computer
Configuration -> Windows Settings -> Security Settings -> Local Policies -> Security Options.
If the user attempts to save the password to the Windows password vault, an error will now be displayed:
Credential ManagerWindows
Error Server Active Directory Windows Clients Virtualization PowerShell Exchange Cloud Linux
Unable to save credentials. To save credentials in this vault, check your computer configuration.
Error code: 0x80070520
Error Message: A specified logon session does not exist. It may already have been terminated.
Install-Module CredentialManager
To add new credentials to the Windows Credential Manager, run this command:
New-StoredCredential -Target 'woshub' -Type Generic -UserName '[email protected]' -Password 'Pass321-b' -Persist
'LocalMachine'
You can use saved passwords from Credential Manager in your PowerShell scripts. For example, I can get the saved
username and password as a PSCredential object from the Windows Vault and use it to connect to Exchange Online from
PowerShell.
You can also use the Get-StoredCredential cmdlet to securely retrieve saved credentials in Task Scheduler jobs.
You can also take a look at the Secret Management PowerShell module, which can be used to securely store
passwords and other secrets on Windows. It supports a range of password vaults including KeePass, LastPass,
cmdkey.exe /list
Copy the Target value for the object whose password you want to extract and paste it into the following command:
$cred = Get-StoredCredential -Target LegacyGeneric:target=termsrv/MUNRDS1
[System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR(
Windows Server Active Directory Windows Clients Virtualization PowerShell Exchange Cloud Linux
$cred.Password))
You can also use tools such as Mimikatz to retrieve stored passwords from Credman in plain text (see the example
here).
16 comments 5
RELATED READING
How to Read Outlook Emails with PowerShell Hide Library and Special Folders from File Installing Windows 11 without Network and
Explorer... Internet Connection
April 24, 2024
April 19, 2024 April 18, 2024
16 COMMENTS
ERIC Reply
October 16, 2021 - 5:07 pm
You can convert the credential object password to plaintext by using the following.
$cred = Get-StoredCredential -Target Test1
[System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($cred.Password))
OLEG Reply
November 11, 2021 - 8:45 am
DATASTORM Reply
February 11, 2023 - 9:54 pm
Where do you run this command at? Powershell or CMD line? I’ve tried it in both and does not return
anything but errors.
Command Prompt returns this: “‘Get-StoredCredential’ is not recognized as an internal or external
command,
Windows Server Active Directory Windows Clients Virtualization PowerShell Exchange Cloud Linux
operable program or batch file.”
Powershell returns this in deep red on black background “The term ‘Get StoredCredential’ is not
recognized as the name of a mdlet, function, script file, or operable program. ….”
DATASTORM Reply
February 11, 2023 - 10:00 pm
Okay, I’ve gone to the top of this article and installed the module.
The commands work, but the password characters are all tiny squares with dots in them.
ADMIN
February 21, 2023 - 5:05 pm
Have you tried converting the credential object to a plain text password like this?
$cred =Get-StoredCredential -Target test2
[System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($
In my case, it gets the full plaintext password from the generic credential object.
IAN Reply
June 25, 2022 - 12:55 pm
ADMIN Reply
October 16, 2022 - 5:43 am
AVI Reply
October 19, 2022 - 12:09 pm
as you have mentioned that the windows credentials are not visible in garphics interface. so can i see that
password from command interface, if yes ! then how ?
ADMIN Reply
October 21, 2022 - 12:46 pm
JAYSON Reply
December 11, 2022 - 10:24 am
how?
BJL Reply
March 11, 2023 - 1:30 am
This is so tantalizingly close to getting me what I need. I have an interactive application that needs to run as a
specific user. If I allow Windows to save the entered credentials in Credential Manager when prompted on first
run, it works. But I’m scripting the deployment of these workstations to be fully automated. If I (or someone
else) has to manually type a password after deployment, it’s not fully automated, and I won’t be around to do
this every time. So I’m trying to script it.
The issue is with the “target” value, which corresponds to both the display name and the “Internet or network
address:” values displayed in Credential Manager. If I allow Windows to save this for me by manually going
through the process of initially launching the program and typing the password, the “Target” and “Internet or
network address:” values displayed in Credential Manager are in the format of “domain\username (Interactive
logon)”. But if I use New-StoredCredential or cmdkey /add: to try to automate this, the target displayed in
Credential Manager does not match that exact format. As a result, when I launch the program, it does not
Windows Server Active Directory Windows Clients Virtualization PowerShell Exchange Cloud Linux
recognize/match to the stored credentials, and prompts for the password anyway. I get tripped up in
CredentialManager either by the backslash in “domain\username”, or by the parentheses in “(Interactive logon)’.
If I use cmdkey, I get tripped up by the spaces in the target name, even when single or double-quoted.
I keep thinking there MUST be a way to get this into credential manager in a programmatic way, but I can’t
figure out the syntax on this one.
Anyone want to tackle this one?
JSHAW Reply
January 24, 2024 - 6:52 am
How do I fix error below after entering $cred = Get-StoredCredential -Target Domain:target=xxxxx
“Unable to convert Credential object without username or password to PSCredential object”
NICK Reply
April 12, 2024 - 3:00 pm
When you run the “cmdkey /list” command, you can only retrieve the passwords saved as a “Generic”
type in the credential manager. If you add a credential in under the generic type, then the commands
in this post work.
JPSO Reply
April 10, 2024 - 5:03 pm
Hello,
Thx a lot for sharing your knowledge, very good post.
Here is some PowerShell code I use to get CredentialManager module working on every PC on which I’m running
my scripts :
Write-Host ” – Checking ‘CredentialManager’ module : ” -NoNewLine
if (Get-Module -ListAvailable -Name CredentialManager) {
Write-Host “OK” -ForegroundColor Green
} else {
Write-Host “NOK” -ForegroundColor Red
Write-Host ” – Installing ‘CredentialManager’ module … ” -NoNewLine
try {
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Scope CurrentUser -Force -Confirm:$false |
Out-Null
Install-Module CredentialManager -Scope CurrentUser -Force -Confirm:$false | Out-Null
Import-Module CredentialManager | Out-Null
Write-Host “OK” -ForegroundColor Green
} catch {
Write-Host “NOK” -ForegroundColor Red
Write-Host ” – Error : $($_.Exception.Message)” -ForegroundColor Red
}
}
LEAVE A COMMENT
Your Comment
NOTIFY ME OF FOLLOWUP COMMENTS VIA E-MAIL. YOU CAN ALSO SUBSCRIBE WITHOUT COMMENTING.
POST COMMENT
Windows Server Active Directory Windows Clients Virtualization PowerShell Exchange Cloud Linux
Popular Posts
Install and Manage Windows Updates with PowerShell (PSWindowsUpdate)