I have a PowerShell script that incorporates a bunch of different information on servers and workstations to pass off to upper management. As we know, U.M. likes to have everything plain and simple.
What I am trying to do is this... I am using the following script that I found on another S.O. topic that does exactly what I need it to. Pulls up instance names & SQL Server edition / version information.
$inst = (get-itemproperty 'HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server').InstalledInstances
foreach ($i in $inst)
{
$p = (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL').$i
(Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$p\Setup").Version
(Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$p\Setup").Edition
$i
}
The output shows:
12.3.6024.0
Standard Edition
MSSQLSERVER
What I can't seem to figure out, and I have been looking at scripts on here all morning long, is how to get it to show something like:
SQL Server 2014
Standard Edition
MSSQLSERVER
I would like it to report if the version # is 12.x it results SQL Server 2014, 13.x it results SQL Server 2017, etc. etc.
How in the bloody world can I get this done? I am learning PowerShell, but when it comes to switches and all that, I am still a bit behind.
Thanks for the assistance ahead of time.