The excitation by X-rays and cosmic rays of molecular hydrogen in inte
rstellar clouds is analyzed. We carried out detailed calculations of e
ntry efficiencies in rovibrational levels of H-2 following impact with
fast electrons produced by X-ray ionization of the gas. The competing
effect of collisional excitation, and quenching, by the ambient gas i
s examined in detail. Up to date values for H-H-2 collisional rate coe
fficients are adopted, and some derivations of H-2-H-2 rovibrational r
ate coefficients from existing literature data are proposed. Several m
odels as a function of temperature, density, and ionization rate are p
resented. We found that H-2 infrared emission in X-ray dominated regio
ns (XDR) is potentially observable for temperatures and ionization rat
es lower than certain critical values (typically T < 1000 K and zeta/n
(H) < 10(-15) cm(3) s(-1), where zeta is the ionization rate). At high
er temperatures, collisional excitation by the ambient gas dominates t
he population of low vibrational levels, and at higher values of zeta/
n(H), the abundance of H-2 is negligible. If such conditions are satis
fied, the resulting infrared emission spectrum can be used as a diagno
stic of nearby X-ray sources such as in cooling flows in galaxy cluste
rs, quasars, Seyfert galaxies and supernova remnants. The intensity ra
tio of the 2-1S(1) and 1-0S(1) lines measured for the Seyfert galaxy N
GC 1275 is consistent with X-ray pumping.