dbatools

🚀 SQL Server automation and instance migrations have never been safer, faster or freer

What is dbatools?

🚀 SQL Server automation and instance migrations have never been safer, faster or freer

Overview of dbatools

What it is

dbatools is a PowerShell module that provides nearly 700 commands for SQL Server administration and automation. It is designed to replace manual SQL Server management tasks with scriptable, repeatable operations. The module supports SQL Server 2008/R2 (93% of commands), SQL Server 2012+ (100%), Azure SQL VM, Azure SQL Database (40%), Azure SQL Managed Instance (60%), and Containers/Kubernetes (75%). It runs on Windows (PowerShell v3+), Linux (PowerShell Core 7.4.0+), and macOS (PowerShell Core 7.4.0+).

Key features

  • Migrate entire SQL Server instances with a single command using Start-DbaMigration.
  • Test hundreds of backups automatically with Test-DbaLastBackup.
  • Discover SQL instances on a network with Find-DbaInstance.
  • Find databases across multiple servers with Find-DbaDatabase.
  • Generate instant HTML or Excel reports for documentation.
  • Manage 100+ SQL instances from a single PowerShell console.

Use cases

  • Backups & Restores: Backup all databases, perform simple restores, and test all backups on a different server.
  • Migrations: Migrate entire SQL instances, copy agent jobs between servers.
  • Monitoring & Health: Find databases without recent backups, check for corruption, monitor currently running queries.
  • Finding & Discovery: Find databases across multiple servers, locate stored procedures containing specific text, discover SQL instances on the network.

Getting started

powershell # Check your PowerShell version (v3+ required for Windows, Core 7.4+ for Linux/macOS) $PSVersionTable.PSVersion # Install (Windows/Linux/macOS) Install-Module dbatools -Scope CurrentUser # See your databases Get-DbaDatabase -SqlInstance localhost # Check your backups Get-DbaLastBackup -SqlInstance localhost | Format-Table # Test your last backup (yes, really!) Test-DbaLastBackup -SqlInstance localhost

License and pricing

The license is MIT. The project is open source.

Based on the project's public README and repository metadata.

Add this badge to your README

Featured on YunoDB Badge styles & help

Maintain this project? Show that it is featured on YunoDB.

Markdown[![Featured on YunoDB](https://yunodb.com/badge/dataplatdbatools.svg)](https://yunodb.com/tools/dataplatdbatools?utm_source=github&utm_medium=badge)
HTML<a href="https://yunodb.com/tools/dataplatdbatools?utm_source=github&utm_medium=badge"><img src="https://yunodb.com/badge/dataplatdbatools.svg" alt="Featured on YunoDB" height="20"></a>