This script will fail while databases are in use.
User have to manually kill all processes related to those databases, which have to restore.
SQL DBA | MCP (70-461,70-462)
The greatest barrier to success is the fear of failure
** Success is a journey not a destination**
Think before you print, SAVE TREES, Protect Mother Nature