In 1900, when the forces of the Eight-Nation Alliance attacked Beijing to suppress the Boxer Rebellion, the Guangxu Emperor and Empress Dowager Cixi fled from the capital and headed towards Xi'an. Cen led military forces from Gansu to Xi'an to protect the emperor and empress dowager, and was awarded the Imperial Yellow Jacket and earned the favour of the Empress Dowager. He was promoted to the position of "xunfu" of Shaanxi but was later reassigned to be the "xunfu" of Shanxi. While in office, he set up the precursor of Shanxi University with the aid of the Welsh missionary Timothy Richard. In 1902, he was reassigned to be the "xunfu" of Guangdong. However, before he could assume office, he was ordered to go to Sichuan instead to replace Kuijun () as the acting-Viceroy of Sichuan after the latter was dismissed from office for his failure to defeat Boxer rebels in Sichuan. While he was in Sichuan, he tightened and enforced government regulations strictly, set up a police force, and accused over 40 officials of corruption. He was nicknamed "Butcher of Officials" () – one of the "Three Butchers of the Late Qing Dynasty" () alongside "Butcher of Money" Zhang Zhidong and "Butcher of Scholars" Yuan Shikai.