José Perez
asked on
Copying files across 2 remote servers
Hi,
amongst all the daily activities I have, there 2 that really takes a lot of time because I have to do it manually :(
Case 1:
I have 1 executable file, "myApp.exe" that needs to be copied (and overwrite existing one) to a second server:
from \\SERVER1\anyFolder\myApp. exe to \\SERVER2\anyFolder\myApp. exe
Issue:
I am trying to do it automatically via CMD script using "runas" command but it is not working transparently because it ask me for password, eache time It connects to a different server (14th servers).
"run.bat" file runs:
runas /netonly /user:AMERICAS\myUserName RemoteServer01.bat
"RemoteServer01.bat" file runs:
Case 2:
This one is done via RDP but I would like to do it via cmd if possible:
Thanks a lot!
amongst all the daily activities I have, there 2 that really takes a lot of time because I have to do it manually :(
Case 1:
I have 1 executable file, "myApp.exe" that needs to be copied (and overwrite existing one) to a second server:
from \\SERVER1\anyFolder\myApp.
Issue:
I am trying to do it automatically via CMD script using "runas" command but it is not working transparently because it ask me for password, eache time It connects to a different server (14th servers).
"run.bat" file runs:
runas /netonly /user:AMERICAS\myUserName RemoteServer01.bat
"RemoteServer01.bat" file runs:
Copy \\RemoteServer01.americas.local\e$\Tools\RMTool\RMTool.exe \\RemoteServer02.americas.local\e$\Tools\RMTool\RMTool.exe /B /Z /Y
Case 2:
This one is done via RDP but I would like to do it via cmd if possible:
First step, connect to \\SERVER1\d$\ProductFolder
Second step, using Windows "Right click / Compress to zipped folder" compress to zip "ProductFolder"
Third, rename resulting zip file adding (manually) current date as a prefix, example of resulting file: "2017-05-05-Oracle.zip"
Fourth step, Move the resulting zip file to \\SERVER1\e$\Backup folder
Second step, using Windows "Right click / Compress to zipped folder" compress to zip "ProductFolder"
Third, rename resulting zip file adding (manually) current date as a prefix, example of resulting file: "2017-05-05-Oracle.zip"
Fourth step, Move the resulting zip file to \\SERVER1\e$\Backup folder
Thanks a lot!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@NVIT
Case 1: Interesting, it makes sense. I'll try it ;)
Case 2: CMD would be excellent! But you must consider the following:
In the servers side I cannt install/copy anything alese. If the 3rd party tool you mention can be coied to my computer and from here run the CMD commands, that'll be very good option.
@Wayne88
I've seen that Powersheel is something like CMD but how can I know/test if this supports what you're recommending?
Case 1: Interesting, it makes sense. I'll try it ;)
Case 2: CMD would be excellent! But you must consider the following:
In the servers side I cannt install/copy anything alese. If the 3rd party tool you mention can be coied to my computer and from here run the CMD commands, that'll be very good option.
@Wayne88
I've seen that Powersheel is something like CMD but how can I know/test if this supports what you're recommending?
"@Wayne88
I've seen that Powersheel is something like CMD but how can I know/test if this supports what you're recommending?"
Hi Jose, how do you mean? The test should very easy because all the program does is copy files/folders. That's all it does. If you like to execute a *.bat or *.exe you still need to call this program before or after the file copy. For example, you can call a batch file after the copy finish to ZIP the folder/file that was copied.
I've seen that Powersheel is something like CMD but how can I know/test if this supports what you're recommending?"
Hi Jose, how do you mean? The test should very easy because all the program does is copy files/folders. That's all it does. If you like to execute a *.bat or *.exe you still need to call this program before or after the file copy. For example, you can call a batch file after the copy finish to ZIP the folder/file that was copied.
@Jose
> Case 2: ...If the 3rd party tool you mention can be coied to my computer and from here run the CMD commands, that'll be very good option.
That should work. I presume your station and the servers are on same domain or workgroup?
> Case 2: ...If the 3rd party tool you mention can be coied to my computer and from here run the CMD commands, that'll be very good option.
That should work. I presume your station and the servers are on same domain or workgroup?
ASKER
@NVIT: Yes, same domain.
Jose,
Do you still need help with this?
Do you still need help with this?
"@Wayne88
I've seen that Powersheel is something like CMD but how can I know/test if this supports what you're recommending?"
Hi Jose, I am not understanding this statement because I didn't mention Powershell. Also, you mentioned that you wanted to run a batch file not powershell and the dirsync program I mentioned can run the batch file as required.
I've seen that Powersheel is something like CMD but how can I know/test if this supports what you're recommending?"
Hi Jose, I am not understanding this statement because I didn't mention Powershell. Also, you mentioned that you wanted to run a batch file not powershell and the dirsync program I mentioned can run the batch file as required.
ASKER
Best answer was @Wayne88 but @NVIT's answer also help me a lot.
Thanks Jose, glad to help. Cheers!
If 3rd party is not an option for you, you can use powershell, assuming you have versions 3 or 4 with Net 4.5 (or greater). Or powershell 5, which has built-in zip commands.
On https://ss64.com/ps/zip.html, there is a powershell routine New-Zipfile that does this. I haven't tested this so can't confirm it.