在远程计算机上使用PowerShell导入PowerShell脚本证书?

使用PowerShell脚本时,您必须确保您的脚本可以使用证书在有问题的机器上运行。 如果对脚本进行了任何更改,则必须重新签名证书以便脚本再次运行; 这很好的工作,直到你想改变你想在多台机器上运行的脚本。

是否可以使用Powershell在远程计算机上为特定脚本导入更新的证书?

如果我更改签名的脚本,我不得不辞职,否则我得到这个错误:

. : File \\server\Redirected\yy-XXXX\My Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 cannot be loaded. The contents of file \\server\Redirected\yy-XXXX\My Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 may have been tampered because the hash of the file does not match the hash stored in the digital signature. The script will not execute on the system. Please see "get-help about_signing" for more details.. At line:1 char:3 + . '\\server\Redirected\yy-XXXX\My Documents\WindowsPowerShell\Microsof ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : SecurityError: (:) [], PSSecurityException + FullyQualifiedErrorId : UnauthorizedAccess 

如果对脚本进行了任何更改,则必须重新签名证书,脚本才能再次运行

这是不正确的。 如果对脚本进行了合法更改,则必须重新对脚本进行签名。 没有必要更改证书,因为它保持不变。