Files
sql-server-samples/samples/manage/DiscoverSql.ps1
T
2021-03-25 23:24:07 -07:00

12 lines
342 B
PowerShell

# This script checks if SQL Server is installed on Windows
[bool] $SqlInstalled = $false
$regPath = 'HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server'
if (Test-Path $regPath) {
$inst = (get-itemproperty $regPath).InstalledInstances
$SqlInstalled = ($inst.Count -gt 0)
}
Write-Output $SqlInstalled