Anyone has a good program script to copy files from one server to another remotely?
I'm trying to script so that I dont have to manually logon to both servers and copy and paste.
I'd tried Powershell using this but per Google search it seems that -tosession does not work.
$session01 = New-PSSession -Credential $myuserID $mypassword -ComputerName $server001
$session02 = New-PSSession -Credential $myuserID $mypassword -ComputerName $server002
Copy-Item -Path "C:\temp\test.txt" -FromSession $session01 -Destination "C:\Temp\test.txt" -ToSession $session02
dont worry about the -credential I will add this later. I just want it to copy first.
Read-Host "Password" -AsSecureString | ConvertFrom-SecureString | Out-File PSCred.txt
$Pass = cat PSCred.txt | ConvertTo-SecureString
$PSCred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User, $Pass
I'm trying to script so that I dont have to manually logon to both servers and copy and paste.
I'd tried Powershell using this but per Google search it seems that -tosession does not work.
$session01 = New-PSSession -Credential $myuserID $mypassword -ComputerName $server001
$session02 = New-PSSession -Credential $myuserID $mypassword -ComputerName $server002
Copy-Item -Path "C:\temp\test.txt" -FromSession $session01 -Destination "C:\Temp\test.txt" -ToSession $session02
dont worry about the -credential I will add this later. I just want it to copy first.
Read-Host "Password" -AsSecureString | ConvertFrom-SecureString | Out-File PSCred.txt
$Pass = cat PSCred.txt | ConvertTo-SecureString
$PSCred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User, $Pass