This will get you the servers and versions... you'll need to incorporate some other code to return the list of dbs on the servers... but once you kow the server names this shouldn't be too difficult
http://www.databasejournal.com/features/mssql/article.php/3397981/Scanning-the-network-for-SQL-Server.htm