Powershell - Delete certificate from Computer Stor

2019-04-20 18:20发布

I am having difficulty getting powershell to delete a certificate that was accidentally installed to all our Windows 7 machines to the Computer Store.

As an example I have included a screen shot of where the certificate is installed (this is not the actual certificate). We have a few hundred machines so we would like to do this as automatic as possible.

If someone could provide a way to delete the certificate by Serial Number or Thumbprint that would be great.

enter image description here

1条回答
走好不送
2楼-- · 2019-04-20 19:16

You can use the Cert:-PSDrive with Get-ChildItem and Remove-Item. Ex:

#Delete by thumbprint
Get-ChildItem Cert:\LocalMachine\My\D20159B7772E33A6A33E436C938C6FE764367396 | Remove-Item

#Delete by subject/serialnumber/issuer/whatever
Get-ChildItem Cert:\LocalMachine\My |
Where-Object { $_.Subject -match 'Frode F' } |
Remove-Item
查看更多
登录 后发表回答