Quantcast
Channel: Active Directory – Jacques Dalbera's IT world
Viewing all articles
Browse latest Browse all 302

PKI – how to delete certificate issued by a specific CA in PowerShell?

$
0
0

To display certificates on local computer store:

C:\Windows\system32>powershell -command “get-item cert:\\LocalMachine\\My\\* | foreach { echo $_.issuer }”

CN=ISSUINGCASERVER, O=company IT Group SA

 

To display certificates on local computer store only with a specified CA:

From a powershell command line:

PS C:\Windows\system32> get-item cert:\\LocalMachine\\My\\* | foreach { if ($_.issuer.Tolower().contains(“issuingcaserver”)){echo $_.issuer;$_.thumbprint}}

CN=ISSUINGCASERVER, O=company IT Group SA

E4895FD30B6BD31BB985F1FBD86FE4802145BC7A

Or

From a command line:

C:\Windows\system32> C:\Windows\system32>powershell -command “get-item cert:\\LocalMachine\\My\\* | foreach { if ($_.issuer.Tolower().contains(\”issuingcaserver\”)){echo $_.issuer}}”

CN=ISSUINGCASERVER, O=company IT Group SA

Or

C:\Windows\system32>powershell -command “$CA=\”issuingcaserver\”;get-item cert:\\LocalMachine\\My\\* | foreach { if ($_.issuer.Tolower().contains($CA)){echo $_.issuer}}”

CN=ISSUINGCASERVER, O=company IT Group SA

 

Finally, to remove a certificate issued by a specific CA:

C:\Windows\system32>powershell -command “$CA=\”issuingcaserver\”;get-item cert:\\LocalMachine\\My\\* | foreach { if ($_.issuer.Tolower().contains($CA)){remove-item $_}}”



Viewing all articles
Browse latest Browse all 302

Trending Articles