Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Import PFX Certificate on remote computers with script

$
0
0

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?


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>