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 (

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.



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


    Gets SQL Server Product Keys from local and remote SQL Servers. Works with SQL Server 2005-2014 
    Using a string of servers, a text file, or Central Management Server to provide a list of servers, this script will go to each server and get the product key for all installed instances. Clustered instances are supported as well. Requires regular user access to the SQL instances, SMO installed locally, Remote Registry enabled and acessible by the account running the script. 
    Uses key decoder by Jakob Bindslet ( 
 .PARAMETER Servers 
    A comma separated list of servers. This can be the NetBIOS name, IP, or SQL instance name 
 .PARAMETER CentralMgmtServer 
    Compiles list of servers to inventory using all servers stored within a Central Management Server. Requires having SQL Management Studio installed. 
 .PARAMETER ServersFromFile 
    Uses a text file as input. The file must be formatted as such: 
    Author  : Chrissy LeMaire 
    Requires:     PowerShell Version 3.0, SQL Server SMO,  Remote Registry 
    Version: 0.8.2 
    DateUpdated: 2015-Mar-25 
 Get-SqlServerKeys winxp, sqlservera, sqlserver2014a, win2k8 
    Gets SQL Server versions, editions and product keys for all instances within each server or workstation. 
 Get-SqlServerKeys -CentralMgmtServer sqlserver01 
        Gets SQL Server versions, editions and product keys for all instances within sqlserver01's Central Management Server 
 Get-SqlServerKeys -ServersFromFile C:\Scripts\servers.txt 
  Gets SQL Server versions, editions and product keys for all instances listed within C:\Scripts\servers.txt 
Apr 7, 2015: Updated script name from Get-SqlServerKeys to Get-SqlServerKeys
Mar 25, 2015: Updated script to explicitly require PowerShell 3
Mar 25, 2015: Added SQL edition
Mar 22, 2015: Fixed some documentation, and updated column names to be more accurate
Mar 21, 2015: First upload