powershell - 使用 powershell 在远程服务器上安装 pfx 证书

标签 powershell certificate installation pfx

按照这个,
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 仅在

  • window 8.1
  • Windows PowerShell 4.0
  • Windows Server 2012 R2

  • 尝试在您的脚本中加载 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/

    相关文章:

    powershell - 使用批处理文件 (.bat) 运行 PS1 脚本

    PHP - SSL 套接字客户端证书

    linux - 如何在服务器端读取客户端发送的 TLS 证书?

    python - 这是否意味着 pip install 的 python 路径不正确?如果是这样,我如何知道正确的道路,然后如何改变它?

    MySQL员工数据库安装

    powershell - 如何在非提升的 powershell 中运行 w32tm

    powershell - Powershell循环写入受密码保护的文件

    vb.net - 如何在 VB.Net 中运行 Powershell 脚本

    ssl - 使用 SAN 证书时公用名无效

    node.js - 在 Windows 8.1 上安装 nodejs 失败