They first lured the Animatronics to the safety of warehouse B,then force shut them down and put them in the restraint units. (Basically a straight jacket with leg parts) They then ran a program called Green-Yellow through thier systems. This deleted all code effected by the virus,leaving code not effected alone. Green-Yellow also gave them the Animatronic equivalent of a vaccine against Indigo so they would never get it again.