In 1945, Hayashi was appointed personal secretary to the Minister of Home Affairs as well as head of the Personnel Section of the Ministry. Shortly after the unconditional surrender of Japan to the Allied Powers in August 1945, he was chosen as Governor of Tottori Prefecture at the age of 38, assuming the office on 27 October, thus becoming the youngest local chief in the history of the Prefecture. However, his tenure was cut short in February 1947 when he became Director of the Bureau of Local Affairs. It was the last post he held in the Home Ministry, which was disbanded by the General Headquarters (GHQ) of the Allied Powers in December 1947. As a transitional arrangement decided in a Cabinet meeting, he was appointed Director of the temporarily established Office of Domestic Affairs in January 1948. The Office was in existence for around 90 days only, during which he was responsible for overseeing the law enforcement services formerly managed by the now-defunct Home Ministry, until the Office was replaced by the National Public Safety Commission.