restore all databases

  • Hello everyone

    I need to restore almost 100 backup put on a folder through a single script

    for that I try to script these 3 lines but the powershell it makes me return errors that can correct me 
    $databases=Get-ChildItem -path C:\folder -Filter *.bak
    foreach($database in $databases)
    {
    Restore-SqlDatabase -ServerInstance .\sqlprod -Database $database -BackupFile $database.fullname
    }


    thank you

  • message is quite clear - access denied 
    the user SQL Server instance is running under needs access to the folder "c:\folder"

Viewing 2 posts - 1 through 1 (of 1 total)

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