将证书从本地复制到远程目标

时间:2018-08-03 09:07:26

标签: powershell null certificate copy-item

每次运行脚本时,我都会在访问远程服务器时收到此错误,请检查所有数据是否正确。尝试使用Invoke-Command。输出相同。

有什么想法吗?

$cred = Get-Credential
$cred
$SourceFilePFX = "\\Certificate\Location"

$SourceFileCER = "\\Certificate\Name"

$Destination = "\\Server\Directory"

Copy-Item -Path $args[0],$args[1] -Destination $args[3] -ArgumentList $SourceFileCER,$SourceFilePFX,$Destination -Credential $cred
Copy-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:6 char:18
+  Copy-Item -Path $SourceFileCER, $args[1] -Destination $Destination
+                  ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Copy-Item], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.CopyItemCommand

0 个答案:

没有答案