In this paper an invariant of motion for Hamiltonian systems is introduced: the Casimir companion. For systems with simple dynamical algebras (e.g., coupled spins, harmonic oscillators) our invariant is useful in problems that consider adiabatically varying the parameters in the Hamiltonian. In particular, it has proved useful in optimal control of changes in these parameters. The Casimir companion also allows simple calculation of the entropy of nonequilibrium ensembles.