Applying the Sarlet-Bahar method one obtains the invariant of equations of motion of the type ῤ + ω2(t)ρ/2 =ꭤ(t)F(β(t)ρ). The corresponding auxiliary equation for the Ermakov system is also obtained, and the results obtained by other authors are generalized.