A challenge in molecular spintronics is to control the magnetic coupling between magnetic molecules and magnetic electrodes to build efficient devices. Here we show that the nature of the magnetic ion of anchored metal complexes highly impacts the exchange coupling of the molecules with magnetic substrates. Surface anchoring alters the magnetic anisotropy of the cobalt(II)-containing complex (Co(Pyipa)2), and results in blocking of its magnetization due to the presence of a magnetic hysteresis loop. In contrast, no hysteresis loop is observed in the isostructural nickel(II)-containing complex (Ni(Pyipa)2). Through XMCD experiments and theoretical calculations we find that Co(Pyipa)2 is strongly ferromagnetically coupled to the surface, while Ni(Pyipa)2 is either not coupled or weakly antiferromagnetically coupled to the substrate. These results highlight the importance of the synergistic effect that the electronic structure of a metal ion and the organic ligands has on the exchange interaction and anisotropy occurring at the molecule-electrode interface.