In March and April 1862, Cooke served as an unpaid volunteer aide for Maj. Gen. J.E.B. Stuart. Cooke was a first cousin of General Stuart's wife, Flora Cooke Stuart. On May 19, 1862, he was formally commissioned as a lieutenant and officially joined Stuart's staff. Cooke participated in the Peninsula Campaign and Stuart's subsequent ride around the Union army of George B. McClellan, later writing a detailed description of the action. Cooke served as an ordnance officer until October 1863. Despite Stuart's secret dislike for Cooke personally, Stuart praised Cooke's service during the Peninsula Campaign and Seven Days' Battles and sought a promotion for him. Stuart was promoted to major general on July 25, 1862. On June 9, 1863, Cooke and other staff members were drawn into combat at the Battle of Brandy Station.