Restore multiple SQL databases in one go

Say you want to move some hundred SQL databases onto a new SQL server without a lot of boring manual work.

A nice Powershell script is published at Technet:

https://gallery.technet.microsoft.com/scriptcenter/SQL-Server-Auto-Restore-08d8c77f

remember to:

remove the -norecovery switch at the end of the script

import-module SQLPS

Example, run the script like this:

.\restoreSQL.ps1 "D:\Backup" "<yourSQLinstance>" "D:\Data" "E:\Logs"

I’ve successfully tested this on SQL 2016 and 2017

More articles