In 1702, he was at siege and capture of Noteburg; in 1703 he participated in the capture of Nyenskans. On 17 May 1704 he was appointed chief commander of St. Petersburg. In this role, he served the city well, making use of the frequent absences St. Petersburg Governor Alexander Danilovich Menshikov to improve defences.