The destroyer minesweeper set out from Norfolk on 24 October 1942 to join Task Force (TF) 34, the North Africa invasion force. "Stansbury" was assigned to Mine Squadron (MinRon) 7 of the Center Attack Group for the landings. The group's assault area was at Fedala just up the coast from Casablanca. The ships arrived off the objective area on 7 November. "Stansbury" and the other minesweepers made an exploratory sweep of the approaches and then she joined the screen in patrolling the transport area. On 15 November, was torpedoed, but thanks to the efforts of "Stansbury", , and she remained afloat throughout the night and was beached at Casablanca the following morning. The destroyer minesweeper returned to Hampton Roads, Virginia, on 26 December 1942. For the next year, she plied the eastern coastal waters of the United States and the North Atlantic as far east as Iceland.