On September 23, 1861, President Abraham Lincoln appointed Barnard to the grade of brigadier general, U.S. Volunteers, to rank from September 23, 1861. Lincoln formally nominated Barnard as brigadier general on December 21, 1861, and the U.S. Senate confirmed the promotion on March 24, 1862. Barnard was Engineer for the Army of the Potomac between August 20, 1861, and August 16, 1862. He participated in the Peninsula Campaign and directed the siege works at Yorktown, Virginia, of offensive and defensive works on the Chickahominy River. On the march to Harrison's Landing on the James River, he reconnoitered and selected positions for the Battle of Gaines Mill, the passage of White Oak Swamp and the Battle of Malvern Hill. After the conclusion of his work in that campaign, he again was engaged in working on the defenses of Washington as chief engineer of the Department of Washington until May 1864. He had certain additional special assignments such as devising the defenses of Pittsburgh, Pennsylvania, during this period.