 In March 1862 he commanded a brigade that defended the Baltimore and Ohio Railroad and, in September 1862 he was given command of the U.S. arsenal at Harpers Ferry.During the Maryland Campaign, in which Confederate general Robert E. Lee invaded the U.S. state of Maryland, Col.Miles's garrison at Harpers Ferry stood directly on Lee's supply line through the Shenandoah Valley.