我在dev中使用下面的PowerShell脚本创建了加密证书。环境。现在,我需要创建部署文档来配置暂存环境上的加密。
$cert = New-SelfSignedCertificate -Subject "AlwaysEncryptedCert" -CertStoreLocation Cert:LocalMachine\My -KeyExportPolicy Exportable -Type DocumentEncryptionCert -KeyUsage KeyEncipherment -KeySpec KeyExchange -KeyLength 2048我需要保留回滚PowerShell脚本以从本地机器中删除证书。使用PowerShell脚本删除证书的正确方法是什么?有人能指点我吗?
发布于 2018-07-11 20:23:46
只有Remove-Item才能删除证书,然后包含-DeleteKey以删除私钥。
根据您的命令,应该是这样的,因为您必须将证书的拇指指纹传递给remove命令,因此我们需要首先查找它:
Get-ChildItem -Path Cert:\LoaclMachine\My -Recurse -DocumentEncryptionCert |
Where-Object Subject -eq 'AlwaysEncryptedCert' | Remove-Item -WhatIfhttps://dba.stackexchange.com/questions/211372
复制相似问题