Use this cmdlet to add a credential to the Priasoft Cached Credential store. The Priasoft Cached Credential store is an encrypted data file that is used to securely shared and provide credentials to Priasoft tools.
PowerShell | ParameterSet: "PSCredential"
Add-CachedCredential
- -CredentialNameOrServer
- -Credential
- [-Overwrite]
PowerShell | ParameterSet: "NetCredential"
Add-CachedCredential
- -CredentialNameOrServer
- -NetworkCredential
- [-Overwrite]
PowerShell | ParameterSet: "FormattedCredential"
Add-CachedCredential
- -CredentialNameOrServer
- -FormattedCredential
- [-Overwrite]
Description
Use the Add-CachedCredential to add a credention to the Priasoft Cached Credential store.
The Priasoft Cached Credential store is an encrypted file that holds one or more credentials that can be shared between Priasoft applications and tools. The cached credentials are not accessible by Windows or other tools. Password info for credentials, once added, cannot be viewed or accessed.
Cached credentials are stored in %appdata%, which is a user-specific folder. As such, there will be two instances of the cached credential store for Super-ExMerge, one for the currently logged on user, and one for the Super-ExMerge service (which runs as LOCALSYSTEM). When adding a new credential with this cmdlet, the credential will be added to both stores. This additionally requires that the Super-ExMerge service is running in order to perform this action.
Examples
Example 1
PowerShell
Add-CachedCredential -Name MyCred -Credential $null
This example will attempt to add a new credential named ‘MyCred’ and will subsequently prompt for the username and password with the standard credential prompt provided by PowerShell and Windows.
Note that in this example, the -Credential $null is a shortcut that causes the credential prompt without requiring a separate Get-Credential call.
Example 2
PowerShell
$cred = New-Object System.Net.NetworkCredential("joe@source.com", "MyPassword")
Add-CachedCredential -Name Source.com -NetworkCredential $cred -Overwrite
This example creates a new System.Net.NetworkCredential object that is then used in the call to Add-CachedCredential.
Note that while the example is valid, it is not recommended to show passwords in clear text. This example shows this only for clarity. In most cases, this version of the cmdlet would be used with other scripted automation that has created a NetworkCredential object.
This example is also using the -Overwrite switch parameter to overwrite a matching credential, if one exists.
Example 3
PowerShell
Add-CachedCredential -Name MyCred -FormattedCredential 'joe@source.com:HostKey#ff8f246388a84931af24ac8daa27b=='
This example shows the use of a formatted credential string. See New-FormattedCredential for more detail.
Parameters
-Name
The Name parameter specifies the name that is associated with the credential. The name can then be used with a FormattedCredential in the form of: “Cached:MyCred”.
-Credential
The Credential parameter specifies a PSCredential value that is used to store the username and password values in the credential store.
-NetworkCredential
The NetworkCredential parameter specifies a System.Net.NetworkCredential object that is used to store the username and password in the credential store.
-FormattedCredential
The FormattedCredential specifies a FormattedCredential that is used to store a username and password in the credential store. The FormattedCredential can be in the form of a string like: username@domain.tld:Password. Refer to New-FormattedCredential for additional detail.
-Overwrite
The Overwrite switch parameter determines whether to overwrite an existing credential with the same name and username.
