Set-SecretVaultDefault

Sets the provided vault name as the default vault for the current user.

Syntax

Set-SecretVaultDefault
   [-Name] <String>
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-SecretVaultDefault
   [-SecretVault] <SecretVaultInfo>
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-SecretVaultDefault
   [-ClearDefault]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

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.

Type:SwitchParameter
Position:0
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

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

-Name

Specifies the name of a registered vault to set as the default vault. Wildcard characters (*) are not permitted.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-SecretVault

Specifies a SecretVaultInfo object representing the registered vault to set as the default vault.

Type:SecretVaultInfo
Position:0
Default value:None
Required:True
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
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

None