The harmonic generation spectra (HGS) of two different ensembles of the same heteronuclear (polar) diatomic molecule are studied. In one ensemble the molecules are aligned (i.e. CO ↔ OC) whereas in the second ensemble the molecules are randomly distributed in different directions (and therefore not all molecules have the same orientation, e.g. CO or OC along one of the axes in the laboratory frame). Using the non-Hermitian formalism of quantum mechanics we prove that the HGS of the two ensembles consist of odd-order harmonics only, provided the photo-induced dynamics is controlled by a single resonance (metastable) state. As we show here by using the Friedrich and Herschbach approach [J. Phys. Chem. A 103, 10280 (1999); J. Chem. Phys. 111, 6157 (1999)], it is possible to distinguish between the ensemble of ‘perfectly’ aligned molecules and an ensemble of molecules with a random directional distribution, provided the dc-field is turned on adiabatically slow and all aligned molecules are in the same quantum state. As an illustrative numerical example the HGS of aligned and ensemble of random directional distributed CO molecules with and without dc field were computed by carrying out ab initio electronic structure calculations.