In 1743, Hersleb was employed as secretary in
Danske Kancelli. In 1745–1763, he served as district judge (
landsdommer) on
Zealand. In 1754, he was appointed deputy burgermaster in Copenhagen. In 1771, he was removed from this post by
Johann Friedrich Struensee alongside the other members of Copenhagen's Magistracy. After Struense's fall in 1772, he was reinstalled as burgermaster. During his years as manager, its building on
Stormgade saw two expansions. In 1760–66. he served as one of the directors of the
Royal Danish Theatre. From 1747, he was a member of the Royal Danish Society for National Gistory. Together with councilman Morten Munck, he was charged with oiverseeing the reorganization of Copenhagen City Archives (completed November 1787). He was awarded the title of
Justitsråd in 1747,
Virkelig justitsråd in 1754,
etatsråd in 1766 and
Konferensråd in 1776. ==Personal life==