We subscribe to idea that developers should release early and release often. dbatools has been around since 2014 but is still in prerelease (0.9.x). It’s been tested by hundreds if not thousands of people and each release gets better and better because of your early suggestions, bug reports and feedback.

We plan for version 1.0 to be gorgeous and standardized. This means that we’ll be introducing breaking changes by fixing our bad habits (inconsistent parameter names, etc). We’re unsure when 1.0 will be finalized but will announce it on our blog when it is.

Minimum Requirements

Server
  • SQL Server 2000
  • No PowerShell needed on the host for SQL Server-only commands 😮
  • PowerShell 2.0 with remoting enabled needed on the host for Windows commands
Workstation
  • Windows 7 with PowerShell v3

dbatools is not required on the server. For more information on installation and requirements see this post.

Method 1: Install dbatools from the PowerShell Gallery

The PowerShell Gallery and the command Install-Module are natively available in Windows 10 and Windows Server 2016. If you run Windows 7, 8, Server 2012 & below you can either install PackageManagement from powershellgallery.com or simply skip to method 2.

Install-Module dbatools

Install-Module requires Run As Administrator, and installs dbatools globally. Don’t have admin access or want to install dbatools only for yourself?

Install-Module dbatools -Scope CurrentUser

Method 2: For legacy (Win7, Win8, etc) systems: scripted installer directly from GitHub

Invoke-Expression (Invoke-WebRequest -UseBasicParsing https://dbatools.io/in)

This will install dbatools locally (for just the current user) to the DocumentsWindowsPowerShellModules folder.

Method 3: Download the zip directly and manually import the module.

Once you’ve extracted the folder, make sure you rename it from dbatools-master or dbatools-development to plain o’ dbatools and place it somewhere in $env:PSMODULEPATH.

Method 4: Clone the repository from GitHub

git clone https://github.com/sqlcollaborative/dbatools

 

Method 5: Offline install

Don’t have Internet access on your DBA workstation? Check out our offline install guide.

Using dbatools

Installing the module will make a number of commands available to you.

dbatools0801

Voila! Now you can migrate SQL Server instances with a single command.

Start-DbaMigration -Source sql01 -Destination sql02 -DetachAttach

Or you can choose your own adventure and migrate just a few things at once.

Copy-Database -Source sql01 -Destination sql02 -Databases Northwind, pubs -BackupRestore -NetworkPath \\serversharesqlmigrations

Copy-DbaLinkedServer -Source sql01 -Destination sql02

Copy-DbaLogin -Source sql01 -Destination sql02 -Logins realcajun,netnerds,’BASEctrlb’

Unsure what to do next? Visit the Getting Started for more information and videos. Or check a list of all the features, which includes some pretty documentation.

Like what you see? Please rate this module on Microsoft Script Center!