The parameters for S-wave elastic scattering of near-zero-energy electrons and positrons by H2 molecules are calculated using the stabilization method with explicitly correlated Gaussians. The confined variational method is applied to optimize the Gaussians to describe the short-range interaction of incident e± with H2 in the fixed-nuclei approximation. For e+-H2 scattering the scattering length of previous work [Phys. Rev. Lett. 103, 223202 (2009)] is substantially improved. More importantly, for e−-H2 scattering, from first principles, the scattering length is computed as a function of the internuclear distance. In the case that the two nuclei are at the equilibrium distance the results are in a good agreement with values derived from fitting experimental total and diffusion cross sections to the modified effective range theory.