dbatools is a free PowerShell module with over 100 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. Want to see the source code? See it on GitHub