I recently took a look at keeping up with SQL Server updates by utilizing dbatools and thought it would be helpful to take a look at staying up to date with dbatools. Updates for everything!
Release Early and Often
The first sentence on the dbatools download page references the belief in releasing early and releasing often. While SQL Server and SQL Server Management Studio may get a handful up dates every year, dbatools averages a few every month. Fortunately, staying up to date with dbatools is easily manageable as we’ll see below.
Latest and Greatest
First, let’s see what version of dbatools we currently have installed. To do so, I’ll open up Windows Powershell by right clicking on it and running as administrator. Then, I’ll pass the name dbatools and run Get-InstalledModule which will return the modules installed using PowerShellGet.
Get-InstalledModule -Name "dbatools"
Our current version is 1.0.130 which is about 7 months old. Navigating to https://www.powershellgallery.com/packages/dbatools/ and checking the version history shows that dbatools gets updated quite often. Let’s go ahead and grab the current version which is 1.0.156.
We’ll run Update-Module dbatools
We may see a message about “Untrusted repository.” We trust this repository so we’ll type Y and press enter to proceed with the update. We’ll then see the update being made:
Once that is complete, we’ll be back to our prompt where we can check our version again:
And see that it has updated successfully. Our version has gone from 1.0.130 to 1.0.156.
If you’re like me, you have your calendar marked with daily tasks, weekly tasks, monthly tasks, etc. Add a reminder to spend a few minutes every couple of weeks or so to update dbatools and you won’t ever fall too far behind. If you want to get fancy, you can even setup an automated job or task to handle it for you.
Thanks for reading!