dbatools is a free PowerShell module with over 200 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


Restore-SqlBackupFromDirectory

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.

Examples

Restore-SqlBackupFromDirectory -SqlServer sqlcluster -Path \fileserver\share\sqlbackups\SQLSERVER2014A

Description

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

 

 

Get-Help

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

Source Code

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

Related commands