I would like to install the Balloon driver for running my Windows in KVM without user any interaction (silent installation).
I'm using powershell to extract the certificate form the driver to some temporary file and then import it to TrustedPublisher using certutil.exe:
$cert = (Get-AuthenticodeSignature "D:\Balloon\2k12R2\amd64\blnsvr.exe").SignerCertificate; [System.IO.File]::WriteAllBytes("c:\redhat.cer", $cert.Export([System.Security.Cryptography.X509Certificates.X509ContentType]::Cert));
certutil.exe -f -addstore "TrustedPublisher" c:\redhat.cer
Then I can install the driver without bothering the user by confirmation:
pnputil -i -a "d:\Balloon\2k12R2\amd64\*.inf"
How can I improve this task to do it all in powershell - without extracting the certificate to temporary file and using certutil.exe to import it?