Executing SQL Agent Job Remotely

  • Hi,

    I need to create a batch file for a user. This batch file will have to execute a Sql agent job on Remote Server.

    I am not able to execute SQL Agent job using batch file remotely.

    User's machine doesn't have sql server installed and we don't want to install it either.

    Is it possible to execute a SQL Agent job from a Batch file out of Remote User's machine where we don't have SQL Server installed???

    Thanks in advance.

    -RP

    -RP
  • You could write a .VBS Script to connect to the server and issue msdb.dbo.sp_start_job @job_name = 'yourjobname'.

    Hope this helps

    Gianluca

    -- Gianluca Sartori

  • Ya, I can do that using VBS but they don't want it. they want it to be done by .bat or .cmd only.

    Is it possible?

    Thanks for your reply..

    -RP

    -RP
  • If you can't have a VBS, then you need something able to connect to SQL server and issue queries. One thing that comes to my mind is sqlcmd or osql. You can copy just the .exe to the client machine and then run it with the query as a parameter. I tried that with osql.exe and it worked, without installing anything on the client side.

    Hope this helps

    Gianluca

    -- Gianluca Sartori

  • You're incredibly lucky: take a look at today's articles:

    http://www.sqlservercentral.com/articles/SQL+Job/66421/

    -- Gianluca Sartori

  • Superb. 🙂 Excellent.

    Thanks a lot for your help, even your post solved my issue, Article has nothing about remote machine without having sql client installed on it.

    I copied that OSQL file on user's machine and tried to run it and it worked... "Bole to Jhakaas" means Outstanding in my language.

    Thanks for your help again.

    -RP

    -RP

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply