Bad batteries shouldn't make the Generator shutdown when it is running, with no power to the switches, I assume you tested these with a voltmeter? Would indicate a fuse problem somewhere, or a burnt wire or transfer switch. Did you smell anything like burnt wiring? My Onan 7.5KW also quit like that, burnt wire on the transfer switch. My transfer switch was located in the electronics box under the fridge, wire was burnt in two, and transfer switch was toast.
Also on the left side of the Generator as you are looking at it, there is an inspection door, held on by two 10mm bolts, gen off, unplugged from shore power, take that inspection plate off and look at the terminal located below, mine was completely covered with corrosion I replaced the terminal block and renewed the connections and all my problems went away.
Jim