Get SQL Server Product Keys for Local and Remote Servers

Note: On June 2, 2015, Get-SqlServerKeys was changed from a script to a module.

Using a string of servers, a text file, or Central Management Server to provide a list of servers, this script obtains the product key and versions for all installed instances on a server or cluster. Supports SQL Server 2005-2014.

Requires regular user access to the SQL instances, SMO installed locally, and, if accessing remote servers, Remote Registry must enabled on the remote server and the account running the script must have permissions to access the registry.

Uses key decoder by Jakob Bindslet (http://goo.gl/1jiwcB)

If Remote Registry must be disabled on your system, you can also run the script locally on your SQL Server and it will find the Product Keys for all local instances using direct registry access.

Examples

Get-SqlServerKeys

Gets SQL Server versions, editions and keys for the local machine.

Get-SqlServerKeys sqlservera, sqlserver2014a, sql01

Gets SQL Server versions, editions and keys for all instances on sqlservera, sqlserver2014a, and sql01

Get-SqlServerKeys -CentralMgmtServer sqlserver01

Gets SQL Server versions, editions and keys for all SQL Server database instances within the Central Management Server on sqlserver01

Get-SqlServerKeys -ServersFromFile C:\Scripts\servers.txt -verbose

Gets SQL Server versions, editions and keys for all servers listed within a file C:\Scripts\servers.txt

 

Powershell Module: