The following TSQL when executed will create the TSQL needed to set all databases in a SQL Server instance to read only mode.
Typical use cases for this might include creating a copy of databases for reporting purposes or when migrating databases from one server to another.
Before you run the outputted script you may need to kill open connections to the databases or certain running activities. Obviously you would want to make sure it is safe to do so before killing any activity.
To kill activities on mass you can use the script in this post.