On the outbreak of War with France in 1793, Hartley held command of the expedition which captured the French settlement of Mahé in Malabar.
In May 1796 he was made a major-general, and appointed to the staff in India.