Custom modes at a wavelength of 1064 nm were generated with a deformable mirror. The required surface deformations of the adaptive mirror were calculated with the Collins integral written in a matrix formalism. The appropriate size and shape of the actuators as well as the needed stroke were determined to ensure that the surface of the controllable mirror matches the phase front of the custom modes. A semipassive bimorph adaptive mirror with five concentric ring-shaped actuators and one defocus actuator was manufactured and characterised. The surface deformation was modelled with the response functions of the adaptive mirror in terms of an expansion with Zernike polynomials. In the experiments the Nd:YAG laser crystal was quasi-CW pumped to avoid thermally induced distortions of the phase front. The adaptive mirror allows to switch between a super-Gaussian mode, a doughnut mode, a Hermite-Gaussian fundamental beam, multi-mode operation or no oscillation in real time during laser operation. For every application there is an ideal intensity distribution which yields optimum results. Such intensity distributions of the beam are commonly called custom modes because their spatial shape is optimised for a specific purpose. Either the special shape of the beam is advantageous for the generation of the laser radiation inside the cavity or for the laser induced process on a target. Due to their high potential in numerous applications we discuss the super-Gaussian mode (also known as top-hat or flat-top mode) and the doughnut mode as two examples of custom modes in the following.The super-Gaussian mode is characterised by a homogeneous intensity distribution and steep edges whereas the doughnut mode exhibits a ring shape with vanishing intensity in the centre of the beam. The intensity distributions of the super-Gaussian mode I SG (r) and the doughnut mode