Gaining control on the size or the direction of the magnetic moment of adsorbed metal-organic molecules constitutes an important step towards the realization of a surface-mounted molecular spin electronics. Such control can be gained by taking advantage of interactions of the molecule's magnetic moment with the environment. The paramagnetic moments of adsorbed metal-organic molecules, for example, can be controlled by the interaction with magnetically ordered substrates. Metalloporphyrins and -phthalocyanines display a quasi-planar geometry, allowing the central metal ion to interact with substrate electronic states. This can lead to magnetic coupling with a ferromagnetic or even antiferromagnetic substrate. The molecule-substrate coupling can be mediated and controlled by insertion layers such as oxygen atoms, graphene, or nonmagnetic metal layers. Control on the magnetic properties of adsorbed metalloporphyrins or -phthalocyanines can also be gained by on-surface chemical modification of the molecules. The magnetic moment or the magnetic coupling to ferromagnetic substrates can be changed by adsorption and thermal desorption of small molecules that interact with the fourfold-coordinated metal center via the remaining axial coordination site. Spin-crossover molecules, which possess a metastable spin state that can be switched by external stimuli such as temperature or light, are another promising class of candidates for control of magnetic properties. However, the immobilization of such molecules on a solid surface often results in a quench of the spin transition due to the interaction with the substrate. We present examples of Fe(II) spin-crossover complexes in direct contact with a solid surface that undergo a reversible spin-crossover transition as a function of temperature, by illumination with visible light, or can be switched by the tip of a scanning tunneling microscope.