Adding Certificate to SharePoint Farm

In this blog, I will give you the powershell commands to add certificate to sharepoint farm server.The certificates created for SharePoint use are stored on each farm server in the LocalMachine\SharePoint store. 
 
# Set the certificate file path
$certPath = "C:\SharePointRootAuthority.cer"
 
# Get the certificate store for "Trusted Root Certification Authorities" (Cert:\LocalMachine\Root)
$certStore = New-Object -TypeName System.Security.Cryptography.X509Certificates.X509Store Root, LocalMachine
 
$cert = New-Object -TypeName System.Security.Cryptography.X509Certificates.X509Certificate2 $certPath
$certStore.Open("MaxAllowed")
$certStore.Add($cert)
$certStore.Close()
 
 
Happy SharePointing :)