We present a system developed to premagnetize liquid samples in an ultra-low-field nuclear magnetic resonance experiment. Liquid samples of a few milliliters are exposed to a magnetic field of about 70 mT, which is abruptly switched off, to leave a transverse microtesla field, where nuclei start precessing. An accurate characterization of the transients and intermediate field level enables a reliable operation of the detection system, which is based on an optical magnetometer.