Linear polarization analysis of hard x-rays is employed to probe electronic anisotropies in metal-containing complexes with very high selectivity. We use the pronounced linear dichroism of nuclear resonant x-ray scattering to determine electric field gradients in an iron(II) containing compound as they evolve during a temperature-dependent high-spin/low-spin phase transition. This method constitutes a novel approach to analyze changes in the electronic structure of metal-containing molecules as function of external parameters or stimuli. The polarization selectivity of the technique allows us to monitor defect concentrations of electronic valence states across phase transitions. This opens new avenues to trace electronic changes and their precursors that are connected to structural and electronic dynamics in the class of metal compounds ranging from simple molecular solids to biological molecules.