Walheim served as a flight controller and operations engineer at the Johnson Space Center from October 1986 to January 1989. He was selected by NASA as an astronaut candidate in March 1996 and reported to the Johnson Space Center in August 1996. Having completed two years of training and evaluation, he was qualified for flight assignment as a mission specialist. Initially, Walheim was assigned technical duties in the Astronaut Office Space Station Operations Branch. Walheim flew three flights, STS-110, STS-122 and STS-135, the final flight of the shuttle, logging over 566 hours in space, including over 36 hours and 23 minutes of EVA time. After his first flight, he was assigned to the EVA branch, where he served as the astronaut office representative for the Extra Vehicular Mobility Unit (the EVA spacesuit).