Manage credentials via PowerShell utilizing the Windows Credential Manager. Call credentials as clear text or as a PSCredential object to be used by other PowerShell Commands
or you can download the module package form here
[[-Password][string]] [[-Target][string]] [[-Type][string]] [[-Comment][string]]
The credenatials can then be used in a command the accepts a PSCredential object like
New-PSSession -ComputerName MyComputer -Credential $Creds
The credentials can then be used in commands the do not accept PSCredential object like
Register-ScheduledTask -User $creds.UserName -Password $Creds.Password
Install
from a PowerShell console window run
Install-Module -Name CredentialManagement
or you can download the module package form here
Extract the package using 7zip or change the file extension to .zip
Commands
Add-StoredCredentials
Add credentials to the Windows Credential Manager
Syntax
Add-StoredCredentials [[-UserName][string]]Parameters
- -UserName
- Type: String
- Required: Yes
- user name of the credential that is to be stored
- -Password
- Type: string
- Required: No
- Password that is to be stored
- If no password is specified a secure message box will display asking for the password
- -Target
- Type: string
- Required: No
- Default: Value of -UserName
- Used to identify what the credentials are to be used for
- -Type
- Type: string
- Required: No
- Default: GENERIC
- Type of credentials to be stored
- More info : https://docs.microsoft.com/en-us/windows/win32/api/wincred/ns-wincred-credentiala
- -Comment
- Type: string
- Required: No
- Default: Date the credentials created and what user created them
- Adds a comment to the credentials in the credential store
Examples
Stores the user name and password as a generic entry for https://my.account.comAdd-StoredCreentials -UserName SamDoe -Password $Password1! -Target https://my.account.com
Remove-StoredCredentials
Remove stored credentials from the Windows Credential Manager
Syntax
Get-StoredCredentials [[-Target][string]] [[-Type][string]]
Parameters
- -Target
- Type: string
- Required: Yes
- Used to identify what the credentials are to be removed
- -Type
- Type: string
- Required: No
- Default: GENERIC
- Used to identify what the credentials are to be removed
Examples
Removes the stored credentials for https://my.account.comRemove-StoredCredentials -Target https://my.account.com
Get-StoredCredentials
Gets the specified credentials stored in Credential Manager as a PSCredential object.
Syntax
Get-StoredCredentials [[-Target][string]] [[-Type][string]]
Parameters
- -Target
- Type: string
- Required: Yes
- Used to identify what credentials to get
- -Type
- Type: string
- Required: No
- Default: GENERIC
- Used to identify what credentials to get
Examples
Gets the credentials for https://my.account.com and stores them in the $Creds variable$Creds = Get-StoredCredentials -Target https://my.account.com
The credenatials can then be used in a command the accepts a PSCredential object like
New-PSSession -ComputerName MyComputer -Credential $Creds
Get-ClearTextStoredCredentials
Gets the specified credentials stored in Credential Manager
Syntax
Get-ClearTextStoredCredentials [[-Target][string]] [[-Type][string]]
Parameters
- -Target
- Type: string
- Required: Yes
- Used to identify what credentials to get
- -Type
- Type: string
- Required: No
- Default: GENERIC
- Used to identify what credentials to get
Examples
Gets the credentials for https://my.account.com and stores them in the $Creds variable$Creds = Get-ClearTextStoredCredentials -Target https://my.account.com
The credentials can then be used in commands the do not accept PSCredential object like
Register-ScheduledTask -User $creds.UserName -Password $Creds.Password
Comments
Post a Comment