title: How can I install a certificate on a remote machine with PowerShell?
body: <p>I'm trying to install a certificate using PowerShell.  I'm testing the installation by creating a remote session with my own computer.  I know the command is correct because outside of the remote session it successfully installs the certificate.  When I do a remote session to my own computer I receive the error:</p>
  
  <blockquote>
    <p>Access is denied. 0x80070005 (WIN32: 5 ERROR_ACCESS_DENIED). This may be the result of user credentials being required on the remote machine. See
    Enable-WSManCredSSP Cmdlet help on how to enable and use CredSSP for delegation with PowerShell remoting.</p>
  </blockquote>
  
  <p>If I run this command without a remote session it works:</p>
  
  <pre><code>Import-PfxCertificate -FilePath "\\network\storage\site.com.pfx" -CertStoreLocation "Cert:\\LocalMachine\\WebHosting" -Password (ConvertTo-SecureString -String "foobar" -AsPlainText -Force)
  </code></pre>
  
  <p>When I execute the command (via <code>Invoke-Command</code>) with a remote session I get the error mentioned above:</p>
  
  <pre><code>$session = New-PSSession $Env:ComputerName
  Invoke-Command -Session $session -ScriptBlock { Import-PfxCertificate -FilePath "\\network\storage\site.com.pfx" -CertStoreLocation "Cert:\\LocalMachine\\WebHosting" -Password (ConvertTo-SecureString -String "foobar" -AsPlainText -Force) }
  </code></pre>
  
  <p>How do I work around this permission issue?</p>