On July 23, 1861, Brigadier General Joseph E. Johnston appointed Ashby lieutenant colonel of the 7th Virginia Cavalry. Due to the illness of the regimental commander, Col. Angus McDonald, Ashby had effective control of half of the regiment, which he operated separately. When the commander retired in February 1862, Ashby assumed command of the entire regiment on March 12. Ashby organized the first Confederate horse artillery, named Chew's Battery, as part of this regiment. The 7th did not participate directly in the First Battle of Manassas, arriving on July 22, but Ashby aided the Confederate cause by screening the movement of Johnston's army to the Manassas area. The Union had hoped that Johnston's forces would be pinned down by Major General Robert Patterson, but Ashby's screen allowed Johnston to move freely without Patterson's interference. In October 1861, Ashby led an attack on Harpers Ferry, the armory having returned to Union control, but lost to Union forces led by Colonel John W. Geary in what became known as the "Battle of Bolivar Heights".