按照这个,
Install certificate with PowerShell on remote server
我正在尝试使用以下 Powershell 命令在远程服务器上安装 pfx 证书,
Invoke-command -ComputerName myservername -scriptblock { Import-PfxCertificate –FilePath D:\pfxcert.pfx cert:\localMachine\my -Password (ConvertTo-SecureString -String "mypassword" -Force –AsPlainText) }
这给我下面的错误信息......
The term 'Import-PfxCertificate' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
+ CategoryInfo : ObjectNotFound: (Import-PfxCertificate:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
+ PSComputerName : myservername
请帮我解决这个问题。
最佳答案
Cmdlet Import-PfxCertificate
是模块的一部分PKIClient
.
Windows PowerShell 中的 PKI 客户端 Cmdlet 仅在
尝试在您的脚本中加载 PKI 客户端:
Invoke-command -ComputerName myservername -scriptblock
{
Get-Command -Module PKIClient;
Import-PfxCertificate –FilePath D:\pfxcert.pfx cert:\localMachine\my -Password (ConvertTo-SecureString -String "mypassword" -Force –AsPlainText)
}
你可以试试
Get-Command -Module PKIClient
查看所有 cmdlet。
关于powershell - 使用 powershell 在远程服务器上安装 pfx 证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28899377/