He served in the Seminole War in Florida, in the Pacific Northwest, and in the Mexican–American War, where he served as Gen. Winfield Scott's inspector general in the march on Mexico City. He received a brevet promotion to colonel for Contreras and Churubusco and to brigadier general for Molino del Rey.