Get Installed SQL Server Instance’s on a Server

List installed SQL Server Instance on a Server. To run this script user should have admin privileges or minimum permission to read OS registry on the server.

DECLARE @Registry_Value VARCHAR(1000)
DECLARE @SQL_In AS TABLE (Id NVARCHAR(MAX),InsName NVARCHAR(25))

INSERT INTO @SQL_In(Id,InsName)
EXECUTE xp_regread 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Microsoft SQL Server','InstalledInstances',@Registry_Value OUTPUT

SELECT @@ServerName [Server Name],InsName [Installed SQL Instance] FROM @SQL_In

GO

Leave a Reply

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