When World War II broke out, Rainer was appointed as Reich Defense Commissioner of "Wehrkreis" (Military District) XVIII, headquartered in Salzburg, which comprised his Reichsgau along with Reichsgau Carinthia, Reichsgau Styria and Reichsgau Tirol-Vorarlberg. This gave him control of civil defense matters over a very large area. On 15 March 1940, he was additionally appointed as the "Reichsstatthalter" (Reich Governor) of Salzburg, thus uniting under his control the highest party and governmental offices in his jurisdiction. Rainer remained in these offices at Salzburg until 27 November 1941, when he was succeeded by Gustav Adolf Scheel.