簡體   English   中英

Import-PfxCertificate Powershell功能在Localmachine上運行正常,但在其他虛擬機上使用Powershell遠程處理時不起作用

[英]Import-PfxCertificate powershell function work fine on Localmachine but not working when using powershell remoting on other virtual machine

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遠程處理來運行函數,但出現以下錯誤!

在此處輸入圖片說明

在此處輸入圖片說明

有一個提示對話框,您必須接受。 該對話框無法通過編程方式接受。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM