Excluding Read only databases using Ola Hallengren script
It's available for backups.



Though it's a somewhat recent addition, so you may need to upgrade your scripts.

For index maintenance, database status is checked so commands don't actually run on databases that aren't fully accessible.

IF DATABASEPROPERTYEX(@CurrentDatabaseName,'Status') = 'ONLINE'
AND (@CurrentIsDatabaseAccessible = 1 OR @CurrentIsDatabaseAccessible IS NULL)
AND DATABASEPROPERTYEX(@CurrentDatabaseName,'Updateability') = 'READ_WRITE'
BEGIN


Hope this helps!