A fully automatic fail-safe beam shaping system based on a liquid crystal on a silicon spatial light modulator has been implemented in the high-energy kilowatt-average-power nanosecond laser system Bivoj. The shaping system corrects for gain nonuniformity and wavefront aberrations of the front-end of the system. The beam intensity profile and the wavefront at the output of the front-end were successfully improved by shaping. The beam homogeneity defined by the beam quality parameters was improved two to three times. The root-mean-square value of the wavefront was improved more than 10 times. Consequently, the shaped beam from the second preamplifier led to improvement of the beam profile at the output of the first main cryo-amplifier. The shaping system is also capable of creating nonordinary beam shapes, imprinting cross-references into the beam, or masking certain parts of the beam.