snippetsqlMinor
How do you run T-SQL commands on multiple servers from one place?
Viewed 0 times
youserverssqlcommandsplaceonemultiplehowfromrun
Problem
I have some daily and weekly tasks where I run a script to get the required information. What is the way to running this code once and hitting all the servers without having to log into each one of them separately?
Solution
There are a couple of ways to go about this, but natively it sounds like Central Management Servers is a pretty good fit for you.
If it is just "one" script and "one" functionality to pull the information, consider writing a quick PowerShell script that loops through all of your servers (the list of servers can be contained in a text file or a database table, etc.) and executes the script. This is quite simple and painless.
It all depends on how often your script(s) will change and what your comfort level is with each of the different approaches.
If it is just "one" script and "one" functionality to pull the information, consider writing a quick PowerShell script that loops through all of your servers (the list of servers can be contained in a text file or a database table, etc.) and executes the script. This is quite simple and painless.
It all depends on how often your script(s) will change and what your comfort level is with each of the different approaches.
Context
StackExchange Database Administrators Q#88954, answer score: 8
Revisions (0)
No revisions yet.