dbatools is a free PowerShell module with over 180 SQL Server administration, best practice and migration commands included.


Using a string of servers, a text file, or Central Management Server to provide a list of servers, this script obtains the product key for all installed instances on a server or cluster. Requires regular user access to the SQL instances, and, if accessing remote servers, Remote Registry must enabled and acessible by the account running the script.

Uses key decoder by Jakob Bindslet

Output looks like this



From PowerShell, execute Get-Help Get-SqlServerKey -Detailed for more information on this function.

Source Code

Want to see the source code? View Get-SqlServerKey.ps1 on GitHub

Related commands