有没有办法使用PowerShell从我的商店中删除/卸载自签名证书?
我试过了
Remove-Item cert:\LocalMachine\My\$thumb
Run Code Online (Sandbox Code Playgroud)
它不起作用,我得到一个例外说"提供商不支持此操作"
我也试过了
certmgr.msc /del /n "MyTestServer" /s MY
Run Code Online (Sandbox Code Playgroud)
它也没用
如何从商店中卸载证书?
在此先感谢Jeez
Remove-Item不适用于证书,因为在certhell中只提供了cert-provider.在这里找到这些信息
$store = new-object system.security.cryptography.x509certificates.x509Store 'My','CurrentUser'
$store.Open('ReadWrite')
$certs = @(dir cert:\currentuser\my | ? { $_.Subject -like '*MyTestServer*' })
foreach ($cert in $certs) {$store.Remove($cert)}
$store.close()
Run Code Online (Sandbox Code Playgroud)
我找到了解决这里的评论.所以它没有经过测试.
使用 PS 3.0,如果您想通过 subjectName 删除
Get-ChildItem -Path Cert:\CurrentUser\My | where { $_.subject -eq "CN=MysubjectName" } | Remove-Item
Run Code Online (Sandbox Code Playgroud)
发现这篇文章是因为remove-item无法正常工作.
这不是'true'的powershell,但我使用这种方法:
certutil -delstore my "5314bdfa0255be36e53e749d033"
Run Code Online (Sandbox Code Playgroud)
您可以通过cert:\ LocalMachine\my或通过certutil获取指纹.在我的情况下,我有多个具有完全相同名称的证书,所以我更喜欢上面的方法,因为它在删除证书时给了我一个特定的目标.
| 归档时间: |
|
| 查看次数: |
11987 次 |
| 最近记录: |