This script is designed to automate the installation of a digital certificate into the "Trusted Root Certification Authorities" store on a local machine. It can be distributed and executed via Remote Monitoring and Management (RMM) tools, making it ideal for deploying trusted certificates across multiple systems in a managed environment.
# Path to the certificate file $certPath = "C:\Users\username\Downloads\DESKTOP_CERTIFICATE.der"# Check if the file exists if (Test-Path $certPath) { # Import the certificate into the Trusted Root Certification Authorities store $cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 $cert.Import($certPath) # Add the certificate to the local machine Trusted Root store $store = New-Object System.Security.Cryptography.X509Certificates.X509Store "Root", "LocalMachine" $store.Open("ReadWrite") $store.Add($cert) $store.Close() Write-Host "Certificate installed successfully." } else { Write-Host "Certificate file not found at $certPath. Exiting." }
0 comments
Please sign in to leave a comment.