Save-PSCredential¶
SYNOPSIS¶
Saves a PSCredential object to a file.
SYNTAX¶
__AllParameterSets¶
Save-PSCredential [-Credential] <pscredential> [-Path] <string> [<CommonParameters>]
ALIASES¶
This cmdlet has the following aliases, {{Insert list of aliases}}
DESCRIPTION¶
This function takes a PSCredential object and exports it to a file. If the specified file path does not exist, it creates the necessary directory structure before saving the credential.
EXAMPLES¶
EXAMPLE 1¶
$credential = Get-Credential Save-PSCredential -Credential $credential -Path 'C:\secure\credential.cred'
Prompts for a username and password, then saves the credential securely to C:\secure\credential.cred.
EXAMPLE 2¶
$password = ConvertTo-SecureString 'MyPassword' -AsPlainText -Force $credential = New-PSCredential -Username 'UserName' -Password $password Save-PSCredential -Credential $credential -Path 'C:\secure\mycreds.cred'
Saves the predefined credential securely to C:\secure\mycreds.cred.
PARAMETERS¶
-Credential¶
The PSCredential object to be saved.
Type: System.Management.Automation.PSCredential
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: true
ValueFromPipeline: true
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Path¶
The file path to save the PSCredential to.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 1
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
CommonParameters¶
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS¶
System.Management.Automation.PSCredential¶
{{ Fill in the Description }}
OUTPUTS¶
System.Void¶
{{ Fill in the Description }}