Get Your SQL Server Product Key with Powershell #dbatools

I really like the dbatools project. This is a series of PowerShell cmdlets that are built by the community and incredibly useful for migrations between SQL Servers, but also for various administrative actions. I have a short series on these items.

There are lots of tasks that are easily accomplished with both PowerShell and T-SQL.

UPDATE: The cmdlet was renamed to Get-DbaProductKey

Get-SqlServerKey is a command that will find your product keys. It’s not often you might need this, but it’s a pain to track them down from the registry and be sure you get them for all your instances.

Here’s the view from one of my development machines:

2017-01-27 15_31_08-powershell

There is a limitation here that appears to have issues with SQL Server 2016, but it’s still helpful for other versions. You can also specify a list of servers in a file for this to use, as well as using credentials to connect.

A quick, handy item, and one that should make auditing (pre-2016) SQL Servers easy.

About way0utwest

Editor, SQLServerCentral
This entry was posted in Blog and tagged , , . Bookmark the permalink.

4 Responses to Get Your SQL Server Product Key with Powershell #dbatools

  1. Cláudio Silva says:

    Hey Steve, thanks for the post mention dbatools project.
    What version did you have use?
    We have released a new version on 1st Feb and this command was one that was updated to take into account sql server 2016.
    If you don’t have the latest version, can you please update the module and try it again?

    Thanks in advance!
    On behalf dbatools team 🙂


  2. Hey Steve,
    Thanks for the dbatools love! Support for SQL Server 2016 was added in the most recent release which came out on Feb 1.

    I just retested on my local 2016 server which has a number of 2016 instances — all worked. Kind of late, but I promise vnext will be supported faster 😉 It’s just one line of code.


  3. LOL, only now do I see Claudio’s response. Thanks Claudio!


  4. way0utwest says:

    Yikes, you people are on the ball. I don’t think I’ve updated in a couple weeks. I’ll update and then adjust the post.


Comments are closed.