Exporting the SharePoint Root Authority Certificate from PowerShell

If you need to export the SharePoint Root Authority Certificate from PowerShell, here is the process you’ll want to follow:

$cert = (Get-SPCertificateAuthority).RootCertificate
$ct = New-Object System.Security.Cryptography.X509Certificates.X509ContentType
$ct.value__ = 3 # 3 is for PFX, and a value of 1 is for CER
$cert.Export($ct,"Password") | Set-Content C:\export.pfx -Encoding byte # If the content type is CER, leave out the password from the export and set the file name to export.cer)

Trevor Seward is a Microsoft Office Apps and Services MVP who specializes in SharePoint Server administration, hybrid scenarios, and SharePoint Online. He has been working with SharePoint for 16 years from SharePoint 2003 on up, managing environments with terabytes of content for 150,000+ user organizations. Trevor is an author of Deploying SharePoint 2016 and Deploying SharePoint 2019. You can find him on Twitter and in /r/sharepoint.