A mathematical model of a linear electromechanical oscillator with a randomly fluctuating damping parameter as an energy harvester is considered. To demonstrate the idea and present an explicit analytical solution the variations of the damping are taken in a form of a telegraphic process. It is shown that substantial enhancement of the harvested energy can be reached if the proposed process has specially selected characteristics. A close relationship with the mean square stability of the oscillator is established. An analytical result for stationary electrical net mean power is presented.