Solved

batch file running remotely

Posted on 2014-04-24
6
555 Views
Last Modified: 2014-04-24
Hi: I have a batch file on a server that reads:
"c:\mapsuploader\mapsuploader.exe R:\data\deliveries\mapper.csv"
The point being that it points at the local (TO THE SERVER) C Drive.
I want to run this from a PC on the network (by wrapping it into a program such as foxpro); but it appears to be identifying the C drive as that on the pc, not the server.
Does anybody know - without vpn or similar - how a batch file can be executed as though on that machine?
THe alternative would be to schedule the thing to run on the server every 2 mins but that seems a tad excessive.
Thanks!
0
Comment
Question by:ClaytonGlass
6 Comments
 
LVL 13

Assisted Solution

by:stergium
stergium earned 100 total points
ID: 40019976
Hello.
You can do that with psexec from sysinternals
http://technet.microsoft.com/el-gr/sysinternals/bb897553.aspx

psexec  \\computer c:\thatbatchfile.bat  
note that the batch file should be in the remote system you are trying to run.

i hope that helps
0
 
LVL 68

Accepted Solution

by:
Qlemo earned 100 total points
ID: 40019992
Also note that the R: drive might be a mapped drive - and as such not available with PsExec. If it is a network share, use the UNC path instead, and make sure the PsExec account has access to the UNC path.

Depending on the batch file you might not need to run it on the server; instead, create a network share for c:\mapsuploader\ (say \\server\mapsuploader), and run the batch file on the PC with
pushd \\server\mapsuploader
mapsuploader \\server\r\data\deliveries\mapper.csv
popd

Open in new window

0
 
LVL 13

Expert Comment

by:stergium
ID: 40020009
shouldnt this

pushd \\server\mapsuploader
mapsuploader \\server\r\data\deliveries\mapper.csv
popd

Open in new window


be like this ?
pushd \\server\mapsuploader
mapsuploader \\server\r$\data\deliveries\mapper.csv
popd

Open in new window

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Closing Comment

by:ClaytonGlass
ID: 40020012
Thank you very much to you both! Was reading about psexec when qlemo replied so giving points to both. Thanks again.
0
 
LVL 16

Expert Comment

by:gurutc
ID: 40020021
Also, if you have UAC enabled on the remote system, you'll have to elevate psexec.

use the -h option as in:

psexec -h \\remotesystem batchfile.bat

- gurutc
0
 
LVL 16

Expert Comment

by:gurutc
ID: 40020028
And I forgot you also need to include the Accept the Eula command to keep the remote system from not running your command due to the eula popup not being accepted:

psexec -h -accepteula \\remotesystem batchfile.bat

- gurutc
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an explanation of a simple data model to help parse a JSON feed
Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
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…

910 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