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


Many SQL Server database administrators use Ola Hallengren’s SQL Server Maintenance Solution which can be found at http://ola.hallengren.com.

Hallengren uses a predictable backup structure which made it relatively easy to create a script that can restore an entire SQL Server database instance.




All user databases contained within \fileserver\share\sqlbackups\SQLSERVERA will be restored to sqlcluster, down the most recent full/differential/logs.




From PowerShell, execute Get-Help Restore-DbaBackupFromDirectory -Detailed for more information on this function.

Source Code

Want to see the source code? View Restore-DbaBackupFromDirectory.ps1 on GitHub

Related commands