Execute stored procedure by using link server

3.5k Views Asked by At

I'm facing a problem. I have these 3 servers:

1 Server1
2 Server2
3 Server3

I want to create a job on Server1 which will send email in html format include drives spaces xp_fixeddrives of all three servers.

Please help me - what will be best scenario to achieve this?

1

There are 1 best solutions below

1
On

If you have linked server for server2 & server3 in server1 then you can execute like below

EXEC master.dbo.xp_fixeddrives
EXEC Server2.master.dbo.xp_fixeddrives
EXEC Server3.master.dbo.xp_fixeddrives

Best approach is run the powershell script from SQL job. please check the below example https://gallery.technet.microsoft.com/scriptcenter/PowerShell-and-Notification-50630dc9