Skip to content

Save-PSCredential

SYNOPSIS

Saves a PSCredential to a file.

SYNTAX

Save-PSCredential [-Credential] <PSCredential> [[-Path] <String>] [-ProgressAction <ActionPreference>]
 [<CommonParameters>]

DESCRIPTION

Takes in a PSCredential and saves it to a file.

EXAMPLES

EXAMPLE 1

$Credential = New-PSCredential -UserName "Admin" -Password "P@ssw0rd!"
Save-PSCredential -Credential $Credential

This saves the PSCredential to the default location of $env:HOMEPATH.creds\Admin.cred

EXAMPLE 2

$Credential = New-PSCredential -UserName "Admin" -Password "P@ssw0rd!"
Save-PSCredential -Credential $Credential -Path "C:\Temp"

This saves the PSCredential to the location of C:\Temp\Admin.cred

PARAMETERS

-Credential

The PSCredential to save.

Type: PSCredential
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

-Path

The folder path to save the PSCredential to.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: "$env:HOMEPATH\.creds"
Accept pipeline input: False
Accept wildcard characters: False

-ProgressAction

{{ Fill ProgressAction Description }}

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.Void

NOTES