You are here

PowerShell - Get All SQL Instances On Server

This script will return all SQL instances running on a server or list of servers.

cls
Import-Module -Name SQLPS -DisableNameChecking

$servers = "SERVER_NAME", "SERVER_NAME_2", "ETC";

foreach($server in $servers)
{
    $path = "SQLServer:\SQL\" + $server;
    $instances = Get-ChildItem -Path $path;
    $instances;
}
Categories: 
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
4 + 5 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer