Remove-Secret
从指定的注册扩展保管库中删除机密。
语法
Remove-Secret
[-Name] <String>
[-Vault] <String>
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Remove-Secret
[-InputObject] <SecretInformation>
[-WhatIf]
[-Confirm]
[<CommonParameters>]
说明
按名称从已注册的扩展保管库中删除机密。 必须同时提供机密名称和扩展保管库名称。
示例
示例 1
Remove-Secret -Name secretTest -Vault CredMan
Get-Secret -Name secretTest -Vault CredMan
Get-Secret: The secret secretTest was not found.
此示例从 CredMan
保管库中删除 secretTest
机密。
Get-Secret
命令验证保管库中不再存在机密。
示例 2
Get-SecretInfo -Name Secret2 -Vault CredMan | Remove-Secret
Get-Secret -Name Secret2 -Vault CredMan
Get-Secret: The secret Secret2 was not found.
此示例从 CredMan
保管库中删除 Secret2
机密。
Get-SecretInfo
检索机密的信息,并通过管道发送结果以 Remove-Secret
。
Get-Secret
验证保管库中不再存在机密。
参数
-Confirm
在运行 cmdlet 之前,提示你进行确认。
类型: | SwitchParameter |
别名: | cf |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-InputObject
指定描述保管库机密的 SecretInformation 对象。
类型: | SecretInformation |
Position: | 0 |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-Name
指定要删除的机密的名称。 不允许使用通配符(*
)。
类型: | String |
Position: | 0 |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-Vault
指定要从中删除机密的保管库的名称。 不允许使用通配符(*
)。
类型: | String |
Position: | 1 |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-WhatIf
显示 cmdlet 运行时会发生什么情况。 cmdlet 未运行。
类型: | SwitchParameter |
别名: | wi |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
输入
Microsoft.PowerShell.SecretManagement.SecretInformation
输出
None