What is the best powershell script to restore an SQL Database?
- by EtienneT
To restore an SQL Server 2008 database, I would lile to be able to just do something like this in powershell:
./restore.ps1 DatabaseName.bak
Then the powershell script would by convention restore it to a database with name "DatabaseName". It would disconnect any user connected to this database so that it can restore the DB. It would store the mdf and ldf in the default location.
This would mainly be while developing on my personal machine. Just a quick way to restore a DB.
Anyone has such a script?
Thanks