Thanks for this great script!!
FYI, I have a couple of offline databases on a non-production server and got an error that stopped the script when I ran it.
I was able to work around it by modifying the sys.databases query to this:select name from sys.databases where state_desc = 'ONLINE' order by name
Thanks again!
- webrunner
-------------------
A SQL query walks into a bar and sees two tables. He walks up to them and asks, "Can I join you?"
Ref.: http://tkyte.blogspot.com/2009/02/sql-joke.html