Unregister-SecretVault

Un-registers an extension vault from SecretManagement for the current user.

Syntax

Unregister-SecretVault
          [-Name] <String[]>
          [-WhatIf]
          [-Confirm]
          [<CommonParameters>]
Unregister-SecretVault
          [-SecretVault] <SecretVaultInfo>
          [-WhatIf]
          [-Confirm]
          [<CommonParameters>]

Description

This cmdlet un-registers the specified extension vault. Once un-registered, the vault is no longer available to SecretManagement for the current user.

Examples

Example 1

PS C:\> Get-SecretVault

VaultName  ModuleName                        IsDefaultVault
---------  ----------                        --------------
CredMan    Microsoft.PowerShell.CredManStore False
LocalStore Microsoft.PowerShell.SecretStore  True

PS C:\> Unregister-SecretVault LocalStore
PS C:\> Get-SecretVault

VaultName ModuleName                        IsDefaultVault
--------- ----------                        --------------
CredMan   Microsoft.PowerShell.CredManStore False

PS C:\> Get-Secret -Name Secret5
Get-Secret: The secret Secret5 was not found.

PS C:\> Register-SecretVault -Name SecretStore -ModuleName Microsoft.PowerShell.SecretStore -DefaultVault
PS C:\> Get-SecretVault

VaultName   ModuleName                        IsDefaultVault
---------   ----------                        --------------
CredMan     Microsoft.PowerShell.CredManStore False
SecretStore Microsoft.PowerShell.SecretStore  True

PS C:\> Get-Secret -Name Secret5
System.Security.SecureString

The first command lists the registered vaults for the current user. The second command un-registers the LocalStore vault. The third command verifies that the vault no longer appears in the registry. The fourth command attempts to retrieve Secret5, but it is not found since its vault was un-registered. The fifth command re-registers the vault under a different name and sets it as the user's default vault. The sixth command verifies that the vault has been re-registered as SecretStore and is the default vault. Finally, the last command retrieves Secret5 from the re-registered vault.

Example 2

PS C:\> Get-SecretVault | Unregister-SecretVault
PS C:\> Get-SecretVault

This example un-registers all extension vaults for the current user. The second command shows that no vaults are registered.

This example un-registers all extension vaults for the current user. Get-SecretVault retrieves all registered vaults for the current user and sends the result through the pipeline to Unregister-SecretVault. Get-SecretVault shows that the secret no longer exists in the vault.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Name

Specifies the name of the vault to un-register. Enter a name or name pattern. Wildcard characters (*) are permitted.

Type:String[]
Position:0
Default value:None
Accept pipeline input:True
Accept wildcard characters:True
-SecretVault

Specifies a SecretVaultInfo object representing the vault to un-register.

Type:SecretVaultInfo
Position:0
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

Microsoft.PowerShell.SecretManagement.SecretVaultInfo

Outputs

None