In 1850, he served as adjudant to then Adjutant General to Fielmarshal Radetzky, after which he was named Colonel and Commander of Infantry Regiment No.
On 25 September 1854 Hartung was promoted major general and appointed command of a brigade in the 2nd Army Corps.
Hartung commanded the IX Corps and contributed significantly to the Austrian victory at Custozza on 24 June 1866.
After he had advanced to become a Felzeugmeister on 22 April 1868, he was awarded the Order of the Iron Crown 1st Class on 19 February 1869 and retired on 1 March 1869 at his own request.
After his retirement, he was appointed a lifelong member of the House of Lords and was repeatedly sent to the delegations of the Austrian Reichsrat.