Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have an exe file on a server, say Server1 which should be run from a SQL job exists on a different server, e.g.: Server2. How can it be done? I know if it's a local file, I can use xp_cmdshell in the Job step and run the exe file, but in our case, this file exists on a different server. If it's doable, what security permissions should be set up to achieve it?

Thanks for your help.

share|improve this question
up vote 3 down vote accepted

Xp_cmdshell would work fine - just access the file using the UNC path (\server1\share\file.exe). As the other person mentioned, make sure you have proper permissions for you sql agent service account to access the file.

If, instead, you actually want to run the file on the remote server, you can use a tool called PSEXEC that will run am exe on another server. This isn't common, but it sounds like it might be what you're looking for. You can get that tool here:

share|improve this answer

You could still use xp_cmdshell; however, you'll need to make sure that your SQL Server Service account (the AD account used to run SQL Server) has access to the directory containing the exe file and any other directories that that program may require.

xp_cmdshell runs on your SQL Server itself; you can use it just like any other command window.

If, on the other hand, you need the exe to run on the machine that hosts it, then you'll need to look at other options.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.