Anyone have an idea how to get Microsoft SQL Server Edition (Express, Standard, Enterprise, Developer) without access to the database or registry?
I got the version like this:
$SQLFP = (Get-WmiObject -Class Win32_Service -ErrorAction Stop | Where-Object { $PSItem.Name -eq 'MSSQLSERVER' } | Select-Object -ExpandProperty PathName).Split('"')[1]
$SQLVer = ([System.Diagnostics.FileVersionInfo]::GetVersionInfo($SQLFP).ProductVersion).Split('.')[0]
Switch ($SQLVer) {
"10" { "Version: Microsoft SQL Server 2008/R2" }
"11" { "Version: Microsoft SQL Server 2012" }
"12" { "Version: Microsoft SQL Server 2014" }
"13" { "Version: Microsoft SQL Server 2016" }
"14" { "Version: Microsoft SQL Server 2017" }
Default { "Unsupported version." }
}
I found plenty of ways to determine the Edition, Patch Levels, Service Packs and stuff from Registry and via SSMS, but unfortunately I have access to neither of them. I do have permission to access the file system.
