Skip to content

Restore-PSCredential

SYNOPSIS

Restores a PSCredential object from a file.

SYNTAX

Restore-PSCredential [-Path] <FileInfo> [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

The Restore-PSCredential function retrieves a PSCredential object that was previously saved using Save-PSCredential. It reads the file from the specified path and ensures the content is a valid PSCredential object before returning it.

EXAMPLES

EXAMPLE 1

Restore-PSCredential -Path 'C:\secure\mycredential.cred'

Restores the PSCredential object from the file located at C:\secure\mycredential.cred.

EXAMPLE 2

'C:\secure\mycredential.cred' | Restore-PSCredential

Uses pipeline input to restore the PSCredential object from the specified file path.

PARAMETERS

-Path

Specifies the path to the credential file to restore.

Type: FileInfo
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
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.Management.Automation.PSCredential

NOTES

https://psmodule.io/PSCredential/Functions/Restore-PSCredential/