需要使用powershell从windows服务器导出和导入证书

需要使用powershell从windows服务器导出和导入证书,powershell,Powershell,我有一个UCCE环境,其中安装了8台Windows服务器和4台CUCM服务器(Linux)。 我需要从所有8台Windows服务器和4台CUCM服务器导出所有证书 代码: 我无法从远程Windows服务器导出证书,我尝试了以下代码: $Srv = "remoteserver.com" $Certs = Invoke-Command -Credential $cred -Computername $Srv -Scriptblock {Get-ChildItem "Cert:\LocalMachin

我有一个UCCE环境,其中安装了8台Windows服务器和4台CUCM服务器(Linux)。 我需要从所有8台Windows服务器和4台CUCM服务器导出所有证书

代码:

我无法从远程Windows服务器导出证书,我尝试了以下代码:

$Srv = "remoteserver.com"
$Certs = Invoke-Command -Credential $cred -Computername $Srv -Scriptblock {Get-ChildItem "Cert:\LocalMachine\My"}

使用
$.
访问where object和foreach object cmdlet中的当前对象


Powershell还有一个可供您使用的
导出证书
cmdlet

我可以访问和下载本地windows计算机证书,但我需要从同一证书路径下载远程windows服务器证书
$Srv = "remoteserver.com"
$Certs = Invoke-Command -Credential $cred -Computername $Srv -Scriptblock {Get-ChildItem "Cert:\LocalMachine\My"}