Posted On July 8, 2019

PowerShell: 1-Liner to Discover SQL Servers on the Network

kimconnect 0 comments
blog.KimConnect.com >> Database >> PowerShell: 1-Liner to Discover SQL Servers on the Network

Run this command on server with SQL CLI installed (this will only detect SQL servers that has the SQL Service Discovery enabled)

PS C:\Windows\system32> [System.Data.Sql.SqlDataSourceEnumerator]::Instance.GetDataSources()

ServerName InstanceName IsClustered Version
---------- ------------ ----------- -------
TESTSQL01 SQLEXPRESS No 14.0.1000.169
TESTSQL02 SQLEXPRESS No 12.0.2000.8
TESTSQL02 SQLEXPRESS01 No 14.0.1000.169
TESTSQL02 SWPDM No 12.0.4100.1

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Install phpMyAdmin in Centos 5.3

# Prerequisite: must install RPMForge Repo prior   yum install httpd php php-mysql php-gd php-mbstring…

Microsoft SQL Cloning Database to a Different DB Name

# User defined variables $sourceSqlServer='DEV-SQL01' $sourceDatabaseName='TEST_MSCRM' $sourceSaCredential=$(get-credential) $destinationSqlServer='DEV-SQL01' $destinationDatabaseName='Test_MSCRM' $destinationSaCredential=$(get-credential) function copyDatabase{ param( $sourceSqlServer, $sourceDatabaseName,…

Some Old SQL Snippets

--Visibar_TestSELECT STK_ROOM, BIN, INV_CODE, LOC_DESCFROM LOCATION_DESCRIPTIONWHERE (STK_ROOM IN (@Stock)) AND (BIN IN (@Bins)) -- Query…