Can I run SQL Server Job through Linked Server?

2.3k Views Asked by At

I have two SQL Server machines:

  1. SqlServer-1
  2. SqlServer-2

I have a job created on SqlServer-1 named RunExeFile.

SqlServer-2 can access SqlServer-1 through a linked server.

Can I start the job RunExeFile from a stored procedure on SqlServer-2 ?

1

There are 1 best solutions below

4
Mitch Wheat On BEST ANSWER

Yes, you can.

You can run this in your stored procedure on SqlServer-2 against linked Server LinkedServer1:

EXEC LinkedServer1.msdb.dbo.sp_start_job @job_name = N'RunExeFile';

You need to configure RPC and ensure the calling security context is set:

enter image description here