Managed to do this myself.
This script toggles layer styles on and off for all layers in the currently active composition as well as in all compositions nested inside it.
var activeComp = app.project.activeItem;
if (activeComp == null) {
alert("Select a composition.");
} else {
toggleLayerStyles(activeComp);
}
function toggleLayerStyles(curComp) {
for (var i = 1; i <= curComp.layers.length; i++) {
curL = curComp.layer(i);
if (curL.layerStyle.canSetEnabled == true) {
if (curL.layerStyle.enabled == true) {
curL.layerStyle.enabled = false;
} else {
curL.layerStyle.enabled = true;
}
}
if (curL.source instanceof CompItem) {
toggleLayerStyles(curL.source);
}
}
}