• Try modifying the RedgateRestore function, adding the $SQLCommand.CommandTimeout line below.

    $SQLCommand = New-Object system.Data.SqlClient.SqlCommand($SQLQuery, $SQLConnection)

    $SQLCommand.CommandTimeout = 10000

    $SQLCommand.ExecuteNonQuery() | Out-Null

    Setting the CommandTimout value to 10,000 was completely arbitrary on my part but for a database that takes 3 hours to restore it works for me.