PowerTip: Use PowerShell to Find Versions of SQL Server

Doctor Scripto

Dr Scripto

Summary: Use Windows PowerShell to find versions of SQL Server.

Hey, Scripting Guy! Question How can I use Windows PowerShell to see all the versions of SQL Server I have installed?

Hey, Scripting Guy! Answer Use the provider and a list of instances to look them up as if they were files in a directory:

$instances = @(‘KIRK’,’SPOCK’,’PICARD’,’RIKER’)

$instances | ForEach-Object {Get-Item “SQLSERVER:\SQL\$_\DEFAULT”} | Select-Object Name,VersionString

Image of command output

Doctor Scripto
Dr Scripto

Scripter, PowerShell, vbScript, BAT, CMD

Follow Dr Scripto   

0 comments

    Leave a comment