How to remove a certificate from a certificate store programmatically (PowerShell)

Hi all, The following sample will remove a certificate from MY certificate store of the local machine after locating it by serial number: # Pass Serial Number of the cert you want to remove param ($serialNumber = $(throw “Please pass a certificate’s serial number to the script”)) # Access MY store of Local Machine profile…

2

How to get all certificates in the Server Certificates section of IIS Manager programmatically (PowerShell)

Hi all, The certificates in the Server Certificates section of IIS Manager (inetmgr.exe) are certificates located in MY certificate store of the local machine, and their Enhanced Key Usage is Server Authentication. The following sample gets those certs: # Get all certs in MY store of Local Machine profile $store = New-Object System.Security.Cryptography.X509Certificates.X509Store(“My”,”LocalMachine”) $store.Open(“ReadOnly”) $store.Certificates…

3

How to install the response from a CA programmatically (PowerShell)

Hi all,   The other day a customer of mine was creating a SSL certificate request with IIS Manager (inetmgr.exe) with “Create Certificate Request…” action in the Server Certificates section. He was sending that request to a Certificate Authority, and he wanted to programmatically install the .cer file with the response from the CA the…

1

How to export issued certificates from a CA programatically (PowerShell)

Hi all,   The following sample is a conversion of How to export issued certificates from a CA programatically (C#) sample to PowerShell. It will get all the issued certs in the CA database and copy them to a folder:   #Params $strServer = “myserver”; $strCAName = “myserver-CA”; $strPathForCerts = “c:\test\”; # Constants $CV_OUT_BASE64HEADER = 0;…

4

How to export issued certificates from a CA programatically (C#)

Hi all,   The following sample is a simplification of How to get info from client certificates issued by a CA (C#), and gets all the issued certs in the CA database and copies them to a folder:   using System; using System.Windows.Forms; using System.IO; using CERTADMINLib; … // Parameters string strServer = “myserver”; string…

1

How to get info from client certificates issued by a CA (C#, VS 2010)

Hi all,   I developed this sample some time ago: How to get info from client certificates issued by a CA (C#). The other day I tried it on a new machine with Windows 7, Visual Studio 2010 and .NET Framework 4.0, and it didn’t even compile. I had to do the following to make…

3