info@techdevops.com | 437-991-3573 | Data Engineering Services
TechDevOps.com
Resources Tools
Experts in Microsoft SQL Server on Windows, Linux, Containers | Clusters, Always On, FCI | Migrations, Cloud, Performance



Find all SQL Server Instances
by BF (Principal Consultant; Architecture; Engineering)
2015-08-05







Solution #1: (Network Wide)

CMD Prompt - type: SQLCMD -L
or
CMD Prompt - type: OSQL -L

-L list servers



Solution #2: (Network Wide)

Powershell: [System.Data.Sql.SqlDataSourceEnumerator]::Instance.GetDataSources()



Solution #3: (Network Wide)

Download Microsoft Assessment and Planning Tookit



Solution #4: (Local)

PowerShell: Get-Service | ?{ $_.Name -like "MSSQL*" }



Solution #5: (Local)

--T-SQL:

DECLARE @GetMSSQLInstances TABLE (Value nvarchar(150), Instances nvarchar(150), Data nvarchar(150))

Insert into @GetMSSQLInstances
EXECUTE xp_regread
@rootkey = 'HKEY_LOCAL_MACHINE',
@key = 'SOFTWARE\Microsoft\Microsoft SQL Server',
@value_name = 'InstalledInstances'

Select * from @GetMSSQLInstances



Resources:

sqlcmd Utility

The sqlcmd utility lets you enter Transact-SQL statements, system procedures, and script files at the command prompt, in Query Editor in SQLCMD mode, in a Windows script file or in an operating system (Cmd.exe) job step of a SQL Server Agent job. This utility uses OLE DB to execute Transact-SQL batches.

SQL Server Management Studio uses the Microsoft .NET Framework SqlClient for execution in regular and SQLCMD mode in Query Editor. When sqlcmd is run from the command line, sqlcmd uses the OLE DB provider. Because different default options may apply, you might see different behavior when you execute the same query in SQL Server Management Studio in SQLCMD Mode and in the sqlcmd utility.


Microsoft Assessment and Planning Tookit

The Microsoft Assessment and Planning Toolkit makes it easy to assess your current IT infrastructure for a variety of technology migration projects. This Solution Accelerator provides a powerful inventory, assessment, and reporting tool to simplify the migration planning process.