This paper addresses the H2 optimal decoupling of previewed inputs. In particular, the synthesis of a decoupling filter exploiting the preview is carried out by recasting the problem as a single finite-horizon LQ regulator, with a generalized quadratic terminal cost. The present approach is based on a computationally attractive parametrization of the solutions of the associated Hamiltonian differential equation, and can also be applied for the solution of the dual problem, the H2 optimal fixed-lag smoothing problem.