Windows – Preventing Windows from deleteing our root CA

certificatecertificate-authorityiispowershellwindows

I am trying to create a Windows server with an IIS server that has a web site with client certificate authentication. The client certificates are signed by our own root CA. Because of that we must import that CA into the Trusted Root Authorities at the server. I can successfully import the cert and sometimes the first request to the server succeeds. Unfortunately Windows deletes the CA certs quite quickly and after that the request to the server start failing with 403 errors. I've found the following in the Event Viewer:

Successful auto delete of third-party root certificate:: Subject: Sha1 thumbprint: <"The thumbprint of our cert">.

How do I make Windows stop doing this? The server is running on Amazon EC2 and we want to avoid using a custom AMI. I therefore need to be able to disable this using a script (preferably PowerShell).

Best Answer

You should be able to set the relevant group policy setting (Turn off Automatic Root Certificate Updates) via scripting by using the LOCALGPO command found here or by setting the registry value directly:

Key:   HKLM\Software\Policies\Microsoft\SystemCertificates\AuthRoot\
Name:  DisableRootAutoUpdate
Value: 1 
Type:  REG_DWORD