无法将文件从一台Windows机器M01复制到另一台Windows机器M02。
两台机器都在AWS上,相同区域,相同VPC,相同子集上。 SSH和RDP端口都为两台计算机打开。使用PowerShell复制(传输)文件。
代码:
Write-Host "Remote IP:" $record
$destinationpath = "\\$record\c$\installer.exe"
Write-Host "Destination:" $destinationpath
Write-Host "Source:" $agent\installer.exe
Invoke-Command -ScriptBlock {
Copy-Item -Path $agent\installer.exe -Destination $destinationpath -Recurse
}
错误:
Remote IP: xx.x.x.xxx Destination: \\xx.x.x.xxx\c$\installer.exe Source: C:\Users\Administrator\Downloads\installer.exe Copy-Item : The network path was not found At C:\Users\Administrator\Downloads\agent_install_gui.ps1:117 char:30 + ... criptBlock {Copy-Item -Path $agent\installer.exe -Destination $des ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Copy-Item], IOException + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.CopyItemCommand
我曾经测试过连接,
Test-Connection
中失败:
PS C:\Users\Administrator\Downloads\ce_Windows\ce_Windows> Test-Connection cmdlet Test-Connection at command pipeline position 1 Supply values for the following parameters: ComputerName[0]: xx.x.x.xxx ComputerName[1]: Test-Connection : Testing connection to computer 'xx.x.x.xxx' failed: Error due to lack of resources At line:1 char:1 + Test-Connection + ~~~~~~~~~~~~~~~ + CategoryInfo : ResourceUnavailable: (xx.x.x.xxx:String) [Test-Connection], PingException + FullyQualifiedErrorId : TestConnectionException,Microsoft.PowerShell.Commands.TestConnectionCommand Test-Connection : Testing connection to computer 'xx.x.x.xxx' failed: Error due to lack of resources At line:1 char:1 + Test-Connection + ~~~~~~~~~~~~~~~ + CategoryInfo : ResourceUnavailable: (xx.x.x.xxx:String) [Test-Connection], PingException + FullyQualifiedErrorId : TestConnectionException,Microsoft.PowerShell.Commands.TestConnectionCommand Test-Connection : Testing connection to computer 'xx.x.x.xxx' failed: Error due to lack of resources At line:1 char:1 + Test-Connection + ~~~~~~~~~~~~~~~ + CategoryInfo : ResourceUnavailable: (xx.x.x.xxx:String) [Test-Connection], PingException + FullyQualifiedErrorId : TestConnectionException,Microsoft.PowerShell.Commands.TestConnectionCommand Test-Connection : Testing connection to computer 'xx.x.x.xxx' failed: Error due to lack of resources At line:1 char:1 + Test-Connection + ~~~~~~~~~~~~~~~ + CategoryInfo : ResourceUnavailable: (xx.x.x.xxx:String) [Test-Connection], PingException + FullyQualifiedErrorId : TestConnectionException,Microsoft.PowerShell.Commands.TestConnectionCommand