dataplat / dbatools
š SQL Server automation and instance migrations have never been safer, faster or freer
AI Architecture Analysis
This repository is indexed by RepoMind. By analyzing dataplat/dbatools in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.
Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.
Repository Overview (README excerpt)
Crawler viewdbatools **Migrate SQL Server instances in minutes instead of days.** Test hundreds of backups automatically. Find that one database across 50 servers. dbatools is a PowerShell module with nearly 700 commands that replace manual SQL Server administration with powerful and fun automation. **Performance at Scale:** Migrate terabyte databases in under an hour. Test 1000+ backups per hour. Manage 100+ SQL instances from a single console. Table of Contents ⢠Why dbatools? ⢠Quick Start ⢠System Requirements ⢠Common Use Cases ⢠Installation ⢠Getting Help ⢠Advanced Usage ⢠Troubleshooting ⢠Community & Support ⢠Contributing Why dbatools? | Traditional Methods | dbatools | |-------------------|----------| | **SSMS:** Click through 50 servers manually | **PowerShell:** Query all 50 servers in one command | | **Migration:** Days of planning and execution | **Migration:** Minutes with automated best practices | | **Backup Testing:** Manual restores, hope for the best | **Backup Testing:** Automated verification of all backups | | **Documentation:** Hours of manual collection | **Documentation:** Instant HTML/Excel reports | | **Scripting:** Complex T-SQL across versions | **Scripting:** Consistent commands for SQL 2000-2022 | Quick Start System Requirements SQL Server Support | Version | Commands Supported | |---------|-------------------| | SQL Server 2000 | 75% | | SQL Server 2005 | 90% | | SQL Server 2008/R2 | 93% | | SQL Server 2012+ | 100% | | Azure SQL VM | As per version above | | Azure SQL Database | 40% | | Azure SQL Managed Instance | 60% | | Containers/Kubernetes | 75% | Operating System Support | OS | Commands Supported | PowerShell Required | |----|-------------------|-------------------| | Windows 7/8/10/11 | 100% | v3+ | | Windows Server 2008 R2+ | 100% | v3+ | | Linux (Intel/ARM64) | 78% | Core 7.4.0+ | | macOS (Intel/M1) | 78% | Core 7.4.0+ | š” **Note:** Commands requiring SQL WMI or parameter typically don't work on Linux/macOS. Network Requirements For remote SQL Server management, ensure these ports are accessible: | Protocol | Default Port | Used By | Required For | Firewall Note | |----------|-------------|---------|--------------|---------------| | SQL Database Engine | 1433 | | 62% of commands | Allow inbound on SQL Server | | WS-Management | 5985/5986 | | 25% of commands | Windows Remote Management | | SQL WMI | 135 | | 4% of commands | DCOM/RPC endpoint mapper | | SMB | 445 | | 4% of commands | File sharing for backups | **Firewall Tip:** Create a dedicated Windows Firewall rule group for dbatools management traffic. Common Use Cases Backups & Restores Migrations Monitoring & Health Finding & Discovery Installation Prerequisites Install Methods For Current User (Recommended) For All Users (Requires Admin) Offline Installation ā ļø Certificate Change Notice (v2.5.5+) Starting with v2.5.5, dbatools uses Microsoft Azure Trusted Signing. When upgrading from older versions: Full migration guide ā Getting Help **Resources:** ⢠š Documentation ⢠š Command Reference ⢠š° Blog ⢠š¬ Slack Community Advanced Usage Authentication SQL Authentication Alternative Windows Credentials Storing Credentials Securely PowerShell's provides a fast and secure way to store credentials to disk. The credentials are encrypted using Windows Data Protection API (DPAPI) and can only be decrypted by the same user on the same machine. For more advanced credential management approaches including the Secrets Management module, see Rob Sewell's guide. Custom Ports PowerShell Transcript Troubleshooting Using with Azure PowerShell (Az) or SqlServer Modules If you use dbatools alongside the Az PowerShell module or Microsoft's SqlServer module in the same session, import them in this order to avoid assembly version conflicts: If you still experience conflicts or need to use dbatools with other modules that have assembly conflicts, use the parameter to enable conflict avoidance mode: This skips loading conflicting Azure assemblies when incompatible versions are already loaded. Common Issues **Issue: "Could not connect to SqlInstance"** **Issue: "Access denied" errors** **Issue: Module won't import** For more troubleshooting help, visit our troubleshooting guide or ask in Slack. Community & Support **Get Involved:** ⢠ā Star this repository ⢠š Report issues ⢠š” Request features ⢠š¤ Contribute code **Community Channels:** ⢠#dbatools on SQL Community Slack ⢠#dbatools-dev for contributors ⢠Twitter/X **Stats:** ⢠š¦ 7+ million downloads on PowerShell Gallery ⢠š„ 250+ contributors ⢠šÆ 700+ commands ⢠š 10+ years of active development Contributing We'd love to have you join us! Check out our Contributing Guide and the dbatools-dev Slack channel. License dbatools is licensed under the MIT License. Special Thanks Thank you to all our contributors and the SQL Server community for making this project possible.