1

I wish to add a certificate in central admin using PowerShell script. I have no experience at all with PowerShell. I got this script somewhere from other site but not sure if it's correct or not.

Remove-SPTrustedRootAuthority CASigningRootCert
Remove-SPTrustedRootAuthority CASigningCert
$rootcert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2("full_path_to_updated_certificate_authority_certificate.cer")
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2("full_path_to_signing_certificate.cer")
$tip = Get-SPTrustedIdentityTokenIssuer name_of_trusted_identity_provider   
$tip.SigningCertificate = $cert
$tip.Update()
New-SPTrustedRootAuthority -Name "CASigningRootCert" -Certificate $rootcert
New-SPTrustedRootAuthority -Name "CASigningCert" -Certificate $cert

From above should i replace ?Full_path_to_updated_certificate_authority_certificate.cer with certificate which i have

What should I replace this with?Full_path_to_signing_certificate.cer

What should i replace this with name_of_trusted_identity_provider

If above script is not correct then is there any simple script?

2

To add the certificate to the Central Admin trust is easy. You have to run the below command for each certificate.

$cert = Get-PfxCertificate c:\CsAppTier.cer
New-SPTrustedRootAuthority -Certificate $cert -Name CsAppTier
  • c:\CsAppTier.cer is path & name of the certificate which you want an import.
  • -Name CsAppTier, You can name whatever you want or type of cert it is.

The code you mentioned is related to ADFS configuration.

  • so i replace -Name CsAppTier like mycer.cer ? – Happy Apr 27 '16 at 6:31
  • with full path, i.e. path\mycer.cer – Waqas Sarwar MVP Apr 27 '16 at 6:37
  • but on sharepoint server which path i should select? any path? – Happy Apr 27 '16 at 6:38
  • What is location of certificate? you should save the certificate on the server where you want to run the command – Waqas Sarwar MVP Apr 27 '16 at 6:40
  • But on any location, on the server – Waqas Sarwar MVP Apr 27 '16 at 6:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.