Let’s 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:
remove the -norecovery switch at the end of the script
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