WinSCP file to multiple servers / hosts

Advertisement

ananyboss
Guest

WinSCP file to multiple servers / hosts

Hi,

I want to send a small file to 100–500 servers,
I am currently doing a WinSCP to each server, input username password every time!

Is there any way to automate it?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: Winscp file to multiple servers / hosts

Scripting:
https://winscp.net/eng/docs/scripting

You can upload the file with single line like:
winscp.com /command "open sftp://username@hostname/" "put c:\localfile /remotepath" "exit"
Just copy and paste this to a .bat file as many times as you need and just make sure you have correct hostname on every line.

Reply with quote

alex96
Guest

upload at once to multiple servers

hi Martin,

I try to do it as you wrote below, but unfortunately not succeeded it, so obviously I am doing something wrong.
Please help me with a concrete example, using following datas:
server1: myserver1.com username: username1@myserver1.com password: passw1 folder: root/folder1
server2: myserver2.com username: username2@myserver2.com password: passw2 folder: root/folder2
server3: myserver3.com username: username3@myserver3.com password: passw3 folder: root/folder3
page to be uploaded: C:\folder\example.html

thank you very much in advance.

Alex

Reply with quote

Jagadeesh
Guest

Re: upload at once to multiple servers

I am unable to resolve the user name & password issues.
I am trying to copy a file from my windows local machine remote linux machine which can be connected with a user name & pwd.
I have a batch file as below.
cd\
cd C:\Users\E002856\AppData\Local\WinSCP
WinSCP.com /script=C:\Users\E002856\ScrToCpFilesToMultLoc.txt
ScrToCpFilesToMultLoc.txt is the script file whose code is as below.
open sftp://username:password@172.16.3.30/
put d:\examplefile1.txt /home/test-user/temp/
exit
When I try to execute the batch file, it's asking me to provide the username & pwd again where I provided in the script already.
I can able to execute this code manually with no issue.

Any ideas how to resolve this.
Thanks in Advance.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: upload at once to multiple servers

@Jagadeesh: Please start anew thread and attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, use /log=path_to_log_file command-line argument. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

Advertisement

You can post new topics in this forum