During the Khivan campaign of 1873 he commanded the advanced guard of General Lomakin's column from Kinderly Bay, in the Caspian Sea, to join General Verevkin, from Orenburg, in the expedition to the Khanate of Khiva, and, after great suffering on the desert march, took a prominent part in the capture of the Khivan capital. Later, dressed as a Turkoman, he intrepidly explored in a hostile country the route from Khiva to Igdy on the old riverbed of the Oxus. In 1875, he was given an important command in the expedition against the Khanate of Kokand under General Konstantin Petrovich von Kaufman, showing great capacity in the action of Makram, where he outmanoeuvered a greatly superior force and captured 58 guns, and in a brilliant night attack during the retreat from Andijan, when he routed a large force with a handful of cavalry.