October 29th, 2015

PowerTip: Use PowerShell to Find Versions of SQL Server

Doctor Scripto
Scripter

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

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.

Feedback