Great piece of work, I have meant to do this for quite awhile...
Two minor suggestions:
One, may want to use consistent casing in case you run this procedure in a "case sensitive" environment.
Secondly, may want to add a check to bypass any database that is temporarily offline:
and databaseproperty(name, 'IsOffline') = 0
Cheers!