Powershell for Automating SQL Server Restore.

  • Team,

    Has anybody written a Windows Powershell Script to Automate the SQL Server Restore process.

    I am looking for following Input Parameters:-

    1. DB Name
    2. Backup Path

    The script should be able to script out the Logins before starting the Restore process. I am looking for to Restore the Databases using it's most Recent Backup copy.

    Any help would be Greatly appreciated.

    With Thanks.

     

  • If you can't find it in this collection of great PowerShell scripts, then maybe it can't be done!

     

    https://dbatools.io/

    Michael L John
    If you assassinate a DBA, would you pull a trigger?
    To properly post on a forum:
    http://www.sqlservercentral.com/articles/61537/

  • To be exact to what Micheal mentioned you can use Test-DbaLastBackup it has all the requirements you specified

  • "Test-DbaLastBackup" - I believe this is in the dbatools module.

    MG

    "There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies."
    Tony Hoare

    "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply