All that is known of Cunningham’s earlier military career is that he held a commission in the Scots Brigade in the service of Holland, that he was present at the Battle of St. Denis in 1678 and was wounded there.
Cunningham had reached the rank of captain in March 1688, serving in the Regiment of Foot known as Barthold Balfour's regiment. This regiment fought at the Battle of Killiecrankie on the extreme left with his second, Lieutenant-Colonel Lauder, both were abandoned by their men and Brigadier-General Balfour was killed. In December 1688 Cunningham obtained a majority in the Earl of Arran's Regiment of Cuirassiers.
Cunningham was a passionate anti-Jacobite. In 1689 his services were rewarded by the Colonelcy of a Regiment of Foot which was modeled out of the existing forces in Scotland. The regiment was known as Colonel Cunningham’s Regiment of Foot.
On 30 December 1690, Cunningham was given the colonelcy of a newly-raised regiment of dragoons, the regiment now known as the 7th (or Queen’s Own) Regiment of Hussars. Ordered to the Netherlands, Cunningham landed with his regiment at Williamstadt. Cunningham remained in command until he was promoted to the rank of brigadier at Mariekirk on 1 June 1696. As a brigadier he served in Flanders during the Nine Years' War. He left £2,500 when he died in 1696.
In 1695 he married Grisel, daughter of Archibald Primrose, Lord Carrington.