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

Please note that documentation and command names may be out of date while we work furiously towards 1.0


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

Windows Authentication


SQL Auth – uses same auth for all connections.

Windows account is still used to access (remote/local) registry.


Output looks like this



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

Source Code

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

Related commands