Solved

Copy .exe file from one computer to many over the network

Posted on 2013-11-08
4
921 Views
Last Modified: 2013-11-11
I need to create batch  file :
1.copy .exe to \\remotepc\Temp folder
2.execute .exe on remote PC

I have to do it from my PC to remote PCs across the network

At present time I do it manually
I can execute .exe with following command

PsExec.exe -s \\name "c:\Temp\windows6.1-KB976932-X64.exe" /quiet
0
Comment
Question by:vadimmikhal
  • 2
4 Comments
 
LVL 16

Expert Comment

by:Emmanuel Adebayo
ID: 39634082
I used similar process to apply patches to my dmz servers

You can run a simple script as below

Open a notepad and put all the copy  that you want to do as follow.

@ECHO OFF
Echo This section copy to remote PC/Server
xcopy .exe to \\remotepc1\Temp folder
xcopy .exe to \\remotepc2\Temp folder
xcopy .exe to \\remotepc3\Temp folder
                         .
                         .
                         .
Echo Copy completed
Pause

Echo Start executing on remote PC/Server
PsExec.exe -s \\remotepc1 "c:\Temp\windows6.1-KB976932-X64.exe" /quiet
PsExec.exe -s \\remotepc2 "c:\Temp\windows6.1-KB976932-X64.exe" /quiet
PsExec.exe -s \\remotepc3 "c:\Temp\windows6.1-KB976932-X64.exe" /quiet

Echo Executable completed

Pause
0
 

Author Comment

by:vadimmikhal
ID: 39634134
not sure I follow
Do I have to map drive first
File I want to copy, is on the file server, in shared folder
0
 
LVL 16

Accepted Solution

by:
Emmanuel Adebayo earned 500 total points
ID: 39634166
No you don't need to map drive. I guess the file you are copy is from your PC. If the files are on the remote server, all you need to do is

Xcopy <file> <Source> <destination>

Let say the files you want to copy are on server1\folder\, your batch would become

@ECHO OFF
Echo This section copy to remote PC/Server
xcopy server1\folder\<.exe> \\remotepc1\Temp folder
xcopy server1\folder \\remotepc2\Temp folder
xcopy server1\folder \\remotepc3\Temp folder
                         .
                         .
                         .
Echo Copy completed
Pause

Echo Start executing on remote PC/Server
PsExec.exe -s \\remotepc1 "c:\Temp\windows6.1-KB976932-X64.exe" /quiet
PsExec.exe -s \\remotepc2 "c:\Temp\windows6.1-KB976932-X64.exe" /quiet
PsExec.exe -s \\remotepc3 "c:\Temp\windows6.1-KB976932-X64.exe" /quiet
0
 
LVL 24

Expert Comment

by:lionelmm
ID: 39635619
You would need a shared folder on the remote PCs because xcopy to \\remotepc1\Temp folder will not work unless "temp folder" is a share name. If you try this it may work \\remotepc1\c$\Temp folder assuming that the default share c$ has not been disabled. How many remote PCs are you working on?
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
OfficeMate Freezes on login or does not load after login credentials are input.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now