Restoring multiple databases can be painful especially when each of them have multiple database file(s).
Four years back, I wrote TSQL script that would accept database backup path, and result RESTORE statement(s) with MOVE option. The TSQL script works without xp_cmdshell. One can find the script on below SQLServerCentral url:-
Inside SQLDBATools PowerShell module, I have added a PowerShell cmdlet Script-SQLDatabaseRestore as more robust solution that would script out transact-sql code for RESTORE database(s) operation. It can fetch backup(s) either through backup path provided ,or through backup history from Source SQL Instance. This cmdlet also has the functionality of Point-In-Time recovery along with restoring database with New Name on Target/Destination server. One can find latest code for SQLDBATools module on below url:-
To know how the cmdlet can be used, kindly watch below silent demo video.
Friends, feel free to connect with me for any query. If you like the post, please do like and share.
Happy Coding 🙂