dbatools is a free PowerShell module with over 300 SQL Server administration, best practice and migration commands included.

Please note that documentation and command names may be out of date while we work furiously towards 1.0


Returns a file list from source and destination where source file may overwrite destination. Complex scenarios where a new file may exist is taken into account.
This command will accept a hash object in pipeline with the following keys: Source, SourceDatabase, Destination. Using this command will provide a way to prepare before a complex migration with multiple databases from different sources and destinations.




Calculate space needed for a simple migration with one database with the same name at destination.

Measure-DbaDiskSpaceRequirement -Source INSTANCE1 -Database DB1 -Destination INSTANCE2

Using a PSCustomObject with 2 databases to migrate on SQL2.

) | Measure-DbaDiskSpaceRequirement

Using a CSV file. You will need to use this header line “SourceDestinationDatabaseDestinationDatabase”.

Import-Csv -Path .\migration.csv -Delimiter “`t” | Measure-DbaDiskSpaceRequirement | Format-Table -AutoSize

Using a SQL table. We are DBA after all!

Invoke-DbaSqlCmd -SqlInstance DBA -Database Migrations -Query ‘select Source, Destination, Database from dbo.Migrations’ | Measure-DbaDiskSpaceRequirement


This command was created by Pollus Brodeur. You can find Pollus on Twitter.


From PowerShell, execute Get-Help Measure-DbaDiskSpaceRequirement -Detailed for more information on this function.

Source Code

Want to see the source code? View Measure-DbaDiskSpaceRequirement.ps1 on GitHub

Related commands