During the First Italian War of Independence he fought at Santa Lucia, and was promoted to major in Regiment No. 17 and decorated with the Military Cross of Merit with the war decoration. Thereafter, Hartung fought in the first corps at the Battle of Custozza and during the Five Days of Milan. He took part in the submission of Bologna and of Ancona. In all of these events, he excelled so much that he was awarded the Order of the Iron Crown (3rd class) and promoted to lieutenant colonel.