Set-SecretVaultDefault
Sets the provided vault name as the default vault for the current user.
Syntax
NameParameterSet (Default)
Set-SecretVaultDefault
[-Name] <String>
[-WhatIf]
[-Confirm]
[<CommonParameters>]
SecretVaultParameterSet
Set-SecretVaultDefault
[-SecretVault] <SecretVaultInfo>
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ClearParameterSet
Set-SecretVaultDefault
[-ClearDefault]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Important
The PowerShell team has decided that Secret modules are is 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 will be 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 updates the vault registry to set the provided vault name as the default vault. Only one registered vault can be the default vault.
Examples
Example 1
PS C:\> Get-SecretVault
VaultName ModuleName IsDefaultVault
--------- ---------- --------------
CredMan Microsoft.PowerShell.CredManStore False
LocalStore Microsoft.PowerShell.SecretStore True
PS C:\> Set-SecretVaultDefault -Name CredMan
PS C:\> Get-SecretVault
VaultName ModuleName IsDefaultVault
--------- ---------- --------------
CredMan Microsoft.PowerShell.CredManStore True
LocalStore Microsoft.PowerShell.SecretStore False
PS C:\> Set-SecretVaultDefault -ClearDefault
PS C:\> Get-SecretVault
VaultName ModuleName IsDefaultVault
--------- ---------- --------------
CredMan Microsoft.PowerShell.CredManStore False
LocalStore Microsoft.PowerShell.SecretStore False
This example shows how to set and unset the default vault for the current user. The first command
gets information about all registered vaults and shows that the LocalStore is the default vault
for the user. The second command makes the CredMan vault the default vault. The third command
shows that the CredMan vault is now default, and LocalStore vault is no longer default. The
fourth command uses the ClearDefault parameter to remove the default designation from any
registered vault. The last command shows that there is no default vault.
Parameters
-ClearDefault
Sets the IsDefault property to $false for all registered vaults.
Parameter properties
| Type: | SwitchParameter |
| Default value: | False |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
ClearParameterSet
| Position: | 0 |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-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 a registered vault to set as the default vault. Wildcard characters (*) are
not permitted.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| 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 registered vault to set as the default vault.
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.