Scene Collection Visibility

What was “visible” in 2.7 is now “viewport enabled” in 2.9, if that makes sense.
When a file that was saved in 2.7 is opened in 2.9, only the Collections that were visible are enabled in the viewport. Inexplicably, Viewports are disabled by default in the Outliner.
This requires that I go into the Outliner or Collection Manager, turn on Viewports from the funnel shaped icon, then toggle all the Viewports on, then toggle the individual Collections to visible. I have to do this every time I open one of the thousands of files I created in 2.7 or prior.
Anyone know the solution to this?

You can globally re-enable the eye icon image for all collections + objects by hovering over the Outliner Editor and doing ALT+H. I also made a script that globally enables the camera icon image for collections + objects.

import bpy

## VIEW LAYERS
for view_layer in bpy.context.layer_collection.children:
    view_layer.exclude = False
    view_layer.hide_viewport = False

# COLLECTIONS
for col in bpy.data.collections:
    col.hide_viewport = False
    col.hide_render = False
    
# OBJECTS
for o in bpy.data.objects:
    o.hide_set(False)
    o.hide_render = False

Note: I wasn’t able to get working the re-selection of these icons image unfortunately, as I’m still rather flummoxed on getting a collection’s view layer… Perhaps someone else does.

Cool! Which folder to I put the script in?
I do think it’s the viewports that I need to have enabled though.
Still, this is appreciated and I learned a few things too.

No folder. Just paste the code into a Blender Text Editor and run it via the image icon I highlighted below.

Again, the script isn’t perfect… so you’ll need to still manually re-enable the image icons.

I ran the script and it worked beautifully. I do have to enter it anew for every file I open, but it’s progress.

Very much appreciated!! Thank you!

Edit: Fixed the context overrides so that the script runs the script in a new blend seamlessly.

The long way you could do this is open all of your blends at once and open a Text Editor in them. I made a script a while back that does that, although you’d need to tweak it a bit so that you can open it via a list or dict.