Command works in Powershell but not in PSADT

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.

try running PSADT from an elevated open PS console.
If errors occur, you see them on the console but they won’t be logged.

If you want to log the errors from your lines, look here: How to Log built-in PowerShell commands (non-PSADT commands)

You could try Import-Certificate, might work better. Import-Certificate (pki) | Microsoft Learn