Following the outbreak of the Second World War, Mainguy took command of  and then  before being promoted to captain and taking overall command of Royal Canadian Navy (RCN) destroyers in Halifax in 1941. In 1942 he was appointed acting commodore and took command of RCN destroyers in Newfoundland, quickly followed by an appointment to Ottawa as Chief of Naval Personnel.
He returned to active duty as the commanding officer of  in 1944. As a part of British Pacific Fleet, Uganda took part in the Okinawa campaign.