myDokument.layers.everyItem().visible = false
help you out? (This will hide all layers.)
sorry it doesn't help. I have various layers that I have to turn visible by name. At the moment that is one line of code for every layer and that doesn't look very sexy. So I thought "Maybe I miss a good trick how to combine different items/layers in one command.
Do you mean that you want to be able to undo both layer setting changes in a single undo? If so, this can be done using app.doScript using UndoModes.entireScript:
I hope this helps!