Fail to copy file from one Windows machine M01 to other Windows machine M02.
Both machines are on AWS, on same region, same VPC, same subset. SSH and RDP port are open for both machines. Using PowerShell to copy (transfer) files.
Code:
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
}
Error:
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
I used to Test connection,
Fail in 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