Get Your SQL Server Product Key with Powershell #dbatools

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

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.

    https://github.com/sqlcollaborative/dbatools/pull/610

    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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s