Files
sql-server-samples/DiscoverSql.ps1
T
2021-03-05 00:29:43 -08:00

12 lines
361 B
PowerShell

# This function is to run on each VM to detect if SQL server is installed
[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