如何使用Powershell将文件内容从一台服务器复制到另一台服务器?

时间:2020-03-17 05:55:37

标签: powershell-3.0

我要从serverA复制文件内容,并且必须将该文件放置在serverB中。

code :

$nodefile="D:\Batch\final\$nodelog"

$server="D:\J\config\logs"

$nodepool="Node-small"

$nodelog='12345.log'

$get=Invoke-Command -Computername $Servername -ScriptBlock{Copy-Item $using:server\$using:nodepool\$using:nodelog - destination $using:nodefile}

错误:

Could not find a part of the path
'D:\Batch\final\Node-12345.log'.

+ CategoryInfo          : NotSpecified: (:) [Copy-Item], DirectoryNotFound
   Exception
    + FullyQualifiedErrorId : System.IO.DirectoryNotFoundException,Microsoft.P
   owerShell.Commands.CopyItemCommand
    + PSComputerName        : SERVER A

0 个答案:

没有答案