如何使用PowerShell删除证书 [英] How to remove certificate using powershell
问题描述
网上有一些代码可以做我想做的事情,但它对我不起作用,尝试一下在PowerShell命令行中逐行。
我试图通过其'thumbprint:
$ b从CurrentUser \ Myy商店删除证书$ b
Hi,
There is some code online that is supposed to do what I'm trying to do, but it didn't work for me, trying it in the PowerShell commandline line by line.
I am trying to delete a certificate from the CurrentUser\My store, by its' thumbprint:
get-childitem cert:CurrentUser\My
get-childitem cert:CurrentUser\My
(工作并用各自的指纹列出我的证书)
那么什么? remove-item命令如何工作?我试过了:
(that works and lists my certificates with their respective thumbprints)
then what? how does the remove-item command works? I have tried:
$ store = New-Object System。 Security.Cryptography.X509Certificates.X509Store(我的,CurrentUser)
$ thumbprint =91110a3dd00d5a03a7c7585303fe787653cd4c14
$ cert = $ store.Certificates.Find(FindByThumbprint ,$ thumbprint,$ TRUE)
Remove-Item -Path证书:\ CurrentUser \ Myy \ $ cert
$store = New-Object System.Security.Cryptography.X509Certificates.X509Store("My","CurrentUser)
$thumbprint = "91110a3dd00d5a03a7c7585303fe787653cd4c14"
$cert = $store.Certificates.Find("FindByThumbprint", $thumbprint, $TRUE)
Remove-Item -Path cert:\CurrentUser\My\$cert
我得到:
I get:
确认
cert:\ CurrentUser \ Myy \中的项目有子项,未指定Recurse参数。如果继续,所有
子项将被删除。你确定你想继续吗?
[Y]是[A]全是[N]否[L]否全部[S]暂停[?]帮助(默认为Y):
Confirm
The item at cert:\CurrentUser\My\ has children and the Recurse parameter was not specified. If you continue, all
children will be removed with the item. Are you sure you want to continue?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):
这意味着我做错了什么......
什么是正确的语法去掉它从我的商店中删除特定证书?
非常感谢任何建议,
Ron。
which means I'm doing something wrong...
what's the correct syntax for remove-item to remove a specific certificate from my store?
Much thanks for any suggestions,
Ron.
推荐答案
store = New-Object System.Security.Cryptography.X509Certificates.X509Store(My,CurrentUser)
store = New-Object System.Security.Cryptography.X509Certificates.X509Store("My","CurrentUser)
thumbprint =91110a3dd00d5a03a7c7585303fe787653cd4c14
thumbprint = "91110a3dd00d5a03a7c7585303fe787653cd4c14"
cert =
这篇关于如何使用PowerShell删除证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!