function Import-PfxCertificate
{
param([String]$certPath,[String]$certRootStore = “CurrentUser”,[String]$certStore = “My”,$pfxPass = $null)
$pfx = new-object System.Security.Cryptography.X509Certificates.X509Certificate2
if ($pfxPass -eq $null) {$pfxPass = read-host “Enter the pfx password” -assecurestring}
$pfx.import($certPath,$pfxPass)
#$pfx.import($certPath,$pfxPass,“Exportable,PersistKeySet”)
$store = new-object System.Security.Cryptography.X509Certificates.X509Store($certStore,$certRootStore)
$store.open(“MaxAllowed”)
$store.add($pfx)
$store.close()
}
Import-PfxCertificate “H:\Powershell Script for CRM 2016\CRM2016.testbiztalk.com.pfx” “CurrentUser” “My”
function Import-PfxCertificate
{
param([String]$certPath,[String]$certRootStore = “localmachine”,[String]$certStore = “Other People”,$pfxPass = $null)
$pfx = new-object System.Security.Cryptography.X509Certificates.X509Certificate2
if ($pfxPass -eq $null) {$pfxPass = read-host “Enter the pfx password” -assecurestring}
$pfx.import($certPath,$pfxPass)
#$pfx.import($certPath,$pfxPass,“Exportable,PersistKeySet”)
$store = new-object System.Security.Cryptography.X509Certificates.X509Store($certStore,$certRootStore)
$store.open(“MaxAllowed”)
$store.add($pfx)
$store.close()
}
Import-PfxCertificate “H:\Powershell Script for CRM 2016\CRM2016.testbiztalk.com.pfx” "Localmachine" “Other People”
所以这两个函数在LocalMachine和服务器上运行良好,但我尝试使用PowerShell远程处理运行函数,我得到如下错误!
答案 0 :(得分:1)
您必须接受一个提示对话框。此对话框无法以编程方式接受。