Unregister-SecretVault
Un-registers an extension vault from SecretManagement for the current user.
Syntax
NameParameterSet
Unregister-SecretVault
[-Name] <String[]>
[-WhatIf]
[-Confirm]
[<CommonParameters>]
SecretVaultParameterSet
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 wasn't 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's 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.
Parameter properties
| Type: | SwitchParameter |
| Default value: | False |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | cf |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-Name
Specifies the name of the vault to un-register. Enter a name or name pattern. Wildcard characters
(*) are permitted.
Parameter properties
| Type: | String[] |
| Default value: | None |
| Supports wildcards: | True |
| DontShow: | False |
Parameter sets
NameParameterSet
| Position: | 0 |
| Mandatory: | True |
| Value from pipeline: | True |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-SecretVault
Specifies a SecretVaultInfo object representing the vault to un-register.
Parameter properties
| Type: | Microsoft.PowerShell.SecretManagement.SecretVaultInfo |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
SecretVaultParameterSet
| Position: | 0 |
| Mandatory: | True |
| Value from pipeline: | True |
| Value from pipeline by property name: | True |
| Value from remaining arguments: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet isn't run.
Parameter properties
| Type: | SwitchParameter |
| Default value: | False |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | wi |
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.