So I have some code that extracts the certificate from a driver .cat file and installs it in the local machine’s certificate store. It works in Powershell but when I put it in PSADT, it doesn’t add the certificate but there is no error so I can’t troubleshoot. Does anyone have an idea of what could be happening or how to troubleshoot it?
$FTDIbusSignature = Get-AuthenticodeSignature -FilePath "$dirFiles\ftdibus.cat"
$FTDIportSignature = Get-AuthenticodeSignature -FilePath "$dirFiles\ftdiport.cat"
$store = Get-Item -Path "Cert:\LocalMachine\TrustedPublisher"
$store.Open("ReadWrite")
$store.Add($FTDIbusSignature.SignerCertificate)
$store.Add($FTDIportSignature.SignerCertificate)
$store.Close()
I’ve ensured that both .cat files are in the Files folder.