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


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