In 1708 the situation in Hungary was still not under control, and Heister was reappointed at the head of the army. Here he won the decisive Battle of Trenčín, but was again replaced by the more diplomatic Johann Pálffy, who finally negotiated the end of the war in 1711.