During the Napoleonic Wars, John was given command of the Austrian army in September 1800, despite his personal reluctance to assume the position. He showed personal bravery in the War of the Second Coalition, but his troops were crushed at the Battle of Hohenlinden on 3 December. Demoralized by defeat, the army nearly disintegrated in the subsequent retreat, which was only stopped by an armistice arranged on 22 December. After the Peace of Lunéville in 1801, Archduke John was made General Director of the Engineering and Fortification Service, and later commander of the Theresian Military Academy in Wiener Neustadt.