Unlock-SecretStore

Unlocks SecretStore with the provided password.

Syntax

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

Description

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 was not 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 was not specified. With the vault unlocked, Get-Secret returns Secret1 as a SecureString object.

Parameters

-Password

Specifies the password needed to access the SecretStore.

Type:SecureString
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters: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.

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

Inputs

SecureString

Outputs

None