I have created a bat file to install a certificate in a users CurrentUser's Trusted Root CA if a CA thumprint is not found, however I want to install this without the install dialog popping up for the user to click install. Is this even possible? I have seen some post on here regarding powershell and bypass execution policies but they still did not solve my issue regarding installing the cert without user interaction. Can this be done from a cmd and a bat file?
My script so far:
@ECHO OFF
powershell -command "if (-not (dir cert:\currentuser\root | Where-Object {$_.Thumbprint -eq '2983b93a21c8e5bf6528b798f5782dfdfd9dbab2c'})) {$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2; $cert.Import('C:/myCert.cer'); $store = New-Object System.Security.Cryptography.X509Certificates.X509Store "Root", "CurrentUser"; $store.Open('ReadWrite'); $store.Add($cert); $store.Close();}"
I would format my command but adding newline character to the cmd code does not seem allowed.