5

We have an .exe file on a server, say Server1 which should be run from a SQL Server job that 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?

4

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:

http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

4

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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