Run SQL Query on Multiple Servers Using PowerShell – Serially

Spread the love

As a database administrator, often I have to fetch some metadata from all the SQLServers that we have. Other times, I have to execute some DDL or DML on all the servers.

In this blog and shared video, I show how to write a multiple server PowerShell script where server list source could range from raw text files to some inventory-based query result.

Below is the script used in the above video tutorial.

There are many similar scripts present in the SQLMonitor tool. For example, check-instance-availability.ps1 connects to many SQLServers in parallel threads to check their availability as part of monitoring.

I hope this will be helpful. If you like the blog, do like and subscribe. Thanks.

One Comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.