Set-SecretVaultDefault
语法
NameParameterSet (默认值)
Set-SecretVaultDefault
[-Name] <String>
[-WhatIf]
[-Confirm]
[<CommonParameters>]
SecretVaultParameterSet
Set-SecretVaultDefault
[-SecretVault] <SecretVaultInfo>
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ClearParameterSet
Set-SecretVaultDefault
[-ClearDefault]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
说明
此 cmdlet 更新保管库注册表,将提供的保管库名称设置为默认保管库。 只有一个已注册的保管库可以是默认保管库。
示例
示例 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
此示例演示如何设置和取消设置当前用户的默认保管库。 第一个命令获取有关所有已注册保管库的信息,并显示 LocalStore 是用户的默认保管库。 第二个命令将 CredMan 保管库设为默认保管库。 第三个命令显示 CredMan 保管库现在是默认的,LocalStore 保管库不再为默认值。 第四个命令使用 ClearDefault 参数从任何已注册的保管库中删除默认指定。 最后一个命令显示没有默认保管库。
参数
-ClearDefault
将所有已注册保管库的 IsDefault 属性设置为 $false。
参数属性
参数集
ClearParameterSet
| Position: | 0 |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-Confirm
在运行 cmdlet 之前,提示你进行确认。
参数属性
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-Name
指定要设置为默认保管库的已注册保管库的名称。 不允许使用通配符(*)。
参数属性
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
NameParameterSet
| Position: | 0 |
| 必需: | True |
| 来自管道的值: | True |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-SecretVault
指定一个 SecretVaultInfo 对象,该对象表示要设置为默认保管库的已注册保管库。
参数属性
| 类型: | Microsoft.PowerShell.SecretManagement.SecretVaultInfo
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
SecretVaultParameterSet
| Position: | 0 |
| 必需: | True |
| 来自管道的值: | True |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-WhatIf
显示 cmdlet 运行时会发生什么情况。 cmdlet 未能运行。
参数属性
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
CommonParameters
此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters。
None
输出
None