Edit

Unlock-SecretStore

Unlocks SecretStore with the provided password.

Syntax

Default (Default)

Unlock-SecretStore
    -Password <SecureString>
    [-PasswordTimeout <Int32>]
    [<CommonParameters>]

Description

Important

The PowerShell team has decided that Secret modules are feature complete and will no longer be actively developed. The modules will continue to be supported for security and critical bug fixes. The code repository has been archived.

The latest versions published are:

The nature of secrets has fundamentally changed since this project was designed. Passwordless authentication methods such as passkeys, single sign-on, and federated credential systems such as Microsoft Entra ID, biometrics, and hardware security keys are the future.

This cmdlet unlocks the SecretStore for the current user with the provided password. It can be used to unlock the SecretStore when the configuration requires a password and the prompt configuration option is disabled. The SecretStore remains unlocked in the session until its configured password timeout elapses.

Examples

Example 1

PS C:\> Get-Secret Secret1 -Vault LocalStore
Get-Secret: A valid password is required to access the Microsoft.PowerShell.SecretStore vault.
Get-Secret: The secret Secret1 wasn't found.

PS C:\> Unlock-SecretStore

cmdlet Unlock-SecretStore at command pipeline position 1
Supply values for the following parameters:
SecureStringPassword: *******

PS C:\> Get-Secret Secret1 -Vault LocalStore
System.Security.SecureString

In this example, Get-Secret fails to retrieve Secret1 because the SecretStore vault is locked. Unlock-SecretStore unlocks the vault. The cmdlet prompts for the password because the Password parameter wasn't specified. With the vault unlocked, Get-Secret returns Secret1 as a SecureString object.

Parameters

-Password

Specifies the password needed to access the SecretStore.

Parameter properties

Type:SecureString
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-PasswordTimeout

Specifies how many seconds the SecretStore remains unlocked after authenticating with a password. This parameter overrides the configured password timeout value. After the timeout has elapsed, the current password value is invalidated for the session. Accessing the SecretStore after the timeout requires the password again.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

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

SecureString

Outputs

None