Hello,
I am struggleing to get this working.
I have tried variations of Enter-PSSession and Invoke-Command. My current iteration is this:
Invoke-Command -ComputerName $RDSH -ScriptBlock {
Import-PFXCertificate -CertStoreLocation Cert:\LocalMachine\My -FilePath $using:CertPath -Password $using:CertPass
}
The variables $CertPath, $RDSH and $Certpass are retrieved earlier in the script. $CertPath as a string and $Certpass as a secure string. If I run the command locally with the same variables, the cert gets imported without issue.
I am getting the following error (times as many servers there are in $RDSH)
The PFX file could not be found.+ CategoryInfo : NotSpecified: (:) [Import-PfxCertificate], FileNotFoundException
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.CertificateServices.Commands.ImportPfxCertif
icate
+ PSComputerName : s102.test.com
Any tips?