dbatools

The PowerShell toolkit for SQL Server professionals

Automate administration, migrations, disaster recovery and compliance

PowerShell 7.4.0
PS C:\Projects\Migration> Start-DbaMigration @params

Performing instance migration
    Migrating databases
    [oooooooooooooooo                                                 ]

Type                              Name
----                              ----
Database Certificate              AGCertificate2021_2121
Custom error                      60000:'us_english'
Mail Configuration                Server Configuration
Mail Account                      The DBA Team
Mail Profile                      The DBA Team
Mail Server                       smtp.ad.local
CMS Group                         Production
CMS Instance                      SQL Server 2005 Ent
CMS Instance                      SQL Server 2005
CMS Instance                      SQL Server 2008 R2 Instance
CMS Instance                      SQL Server 2008
CMS Instance                      SQL Server 2012
CMS Group                         Test
CMS Instance                      SQL Server 2000 Dev
CMS Instance                      SQL Server 2005 Express Instance
CMS Instance                      The 2008 Clustered Instance
Server Trigger                    tr_MScdc_db_ddl_event

dbatools is a free, open-source PowerShell module with 600+ commands for SQL Server automation. Manage one instance or thousands with simple, consistent commands.

Trusted by enterprise teams worldwide

Nike United Nations Coca-Cola Walmart BMW
Dell Intuit Hilton Ticketmaster Stackoverflow

What you can do with dbatools

From daily operations to critical projects

🚀

Start-DbaMigration

Migrate entire SQL Server instances in minutes, not days

📸

Export-DbaInstance

Capture complete instance configurations for disaster recovery

Test-DbaLastBackup

Verify every backup actually restores before you need it

🔒

Start-DbaDbEncryption

Enable TDE encryption without manual certificate management

🔄

Invoke-DbaDbLogShipping

Set up log shipping for minimal downtime migrations

Update-DbaInstance

Automate SQL Server patching across your entire estate

Latest Articles

Tips, guides, and updates from the dbatools community

April 5, 2023

Offline Installation of dbatools 2.0 with the dbatools.library Dependency

If you work in an offline environment, you’re probably familiar with how painful it can be to install anything, including PowerShell modules like dbatools. In the past, dbatools had no dependencies, so the installation process was somewhat straightforward — you could even download a zip from our GitHub repo. However, with the introduction of the new dbatools.library dependency, the installation process has become a smidge more complex. In this post, I’ll walk you through the steps to install dbatools (and with it, dbatools.

Read more

January 10, 2020

Working with SQL Client Aliases

SQL Client Aliases allow you to connect to a SQL Server instance using another name. This is especially useful during migrations. Want your servers to connect to the new SQL Server without modifying connection strings within your application? Or what if you could use easy-to-remember names for your docker containers? SQL Client Aliases can help. For the longest time, I managed these aliases using cliconfg for 64-bit applications (C:\Windows\System32\cliconfg.exe) or cliconfg for 32-bit applications (C:\Windows\SysWOW64\cliconfg.

Read more

September 12, 2019

Working with File Sizes in dbatools

Within dbatools, you may notice file sizes are pretty and human-readable. That was some C# based magic created by Microsoft PFE and creator of PSFramework, Fred Weinmann. In the background, SQL Server often gives us different types of numbers to represent file sizes. Sometimes it’s bytes, sometimes it’s megabytes. We wanted to standardize the sizing in dbatools, and thus the dbasize type was born. Usage This size type is cool because it looks beautiful, showing KB, MB, GB, TB and PB.

Read more

September 4, 2019

Learn dbatools in a Month of Lunches

After nearly 10 months of work, early access to Learn dbatools in a Month of Lunches is now available from our favorite publisher, Manning Publications! For years, people have asked if any dbatools books are available and the answer now can finally be yes, mostly 😊. Learn dbatools in a Month of Lunches, written by me and Rob Sewell (the DBA with the beard), is now available for purchase, even as we’re still writing it.

Read more

August 26, 2019

Migrating Super Old App Databases

Recently, a colleague asked me to assist with the migration of some older, customized application databases to a SQL Server 2017 instance. Most of the migrations I perform are rather vanilla, but this one was a bit more involved. Setup Imagine this scenario: Source (APPSQL1) Dedicated SQL Server 2008 R2 failover clustered instance with a non-default collation (SQL_Latin1_General_CP1_CI_AI) Custom .NET application with an intense database containing a non-default collation (also SQL_Latin1_General_CP1_CI_AI), multiple CLR assemblies, and thousands of tables, views, stored procedures, functions Nearly 30 SQL Agent jobs, many of which had to be disabled over the years due to compatibility issues and scope changes Out-of-support for both Microsoft and the application vendor Destination (APPSQL2) Shared server SQL Server 2017 Default collation (SQL_Latin1_General_CP1_CI_AS) There was even a linked server in the mix, but our biggest concerns revolved around the changing collation and the Agent jobs, which were known to be brittle.

Read more

August 20, 2019

dbatools Advanced Configuration

Some dbatools functionality that has not been talked about much on the blog are our internal configuration options. This functionality was added back in October 2017. Kind of like how in ADS or SSMS, you can go to File -> Preferences -> Settings or Edit -> Preferences to edit advanced preferences and options, you can do something similar in dbatools! Since dbatools is command-line based, you can view/modify your current options using our various config commands.

Read more

Ready to automate your SQL Servers?

Install dbatools and get started in seconds.
Works on Windows, Linux, and macOS.

# Install
Install-Module dbatools
# Check who's connected right now
Get-DbaProcess -SqlInstance sql01

Community ❤️ dbatools

Jeffrey Snover

Jeffrey Snover

PowerShell Inventor, Technical Fellow

If you use SQL, someone on the team should be a dbatools pro.

Steve Jones

Steve Jones

MVP & SQLServerCentral.com

If you haven't played with dbatools, I'd recommend you do so; it makes working with SQL and PowerShell much easier.

Argenis Fernandez

Argenis Fernandez

Microsoft, MCM, vExpert

I can't stress enough how good dbatools is. Stop doing it the hard way.

Anthony Nocentino

Anthony Nocentino

MVP, Author, Speaker

It's impossible to quantify the impact this project has had on our community and the tech that we work with. Everyone I introduce to dbatools is blown away by how much this enables productivity and allows DBAs to scale with their systems.

Joey D'Antoni

Joey D'Antoni

MVP, vExpert, DCAC

dbatools is an amazing project. Tasks like server migrations that used to take me hours can now be completed in seconds, and with total confidence.

Gianluca Sartori

Gianluca Sartori

Data Platform MVP, Formula 1 DBA

dbatools is the best thing that happened to SQL Server in the last 5 years.

Jeffery Hicks

Jeffery Hicks

MVP, Author

If you are a SQL person you need to check out the dbatools PowerShell project.

Mike Martin

Mike Martin

Technical Evangelist, Microsoft

If there was a thing such as MVP for MVP'S then dbatools would probably win it.

André Kamman

André Kamman

MVP & Dutch PASS Chapter Leader

dbatools are the most important PowerShell scripts for SQL Server DBAs.

Nikhil Chintalapudi

Nikhil Chintalapudi

SQL Server DBA

Thank you for this module. It's very helpful for a someone like me trying to automate database tasks without very much PowerShell experience.

Michael J Swart

Michael J Swart

Data Platform MVP

This dev just used dbatools to install and migrate 50 db machines at once with little effort or errors. It's truly the easy button.

Andy Nakamura

Andy Nakamura

SQL Saturday Speaker

I had been seriously thinking of quitting the SQL space altogether and decided to get into other things, but this has got to be a great addition to becoming a better DBA.

An open-source community you can trust

Join millions of users and hundreds of contributors shaping the future of SQL Server automation, built by the community for the community since 2014.