was no record of any actual action taken by Zhang Quanyi. (However, in 901, Emperor Zhaozong was restored in a countercoup headed by the imperial guard officers Sun Dezhao (), Dong Yanbi (), and Zhou Chenghui (). Shortly after, Zhang Quanyi was given the honorary chancellor title of Zhongshu Ling (). By 903, Zhu Quanzhong had taken Emperor Zhaozong under his control, and was planning on eventually usurping the Tang throne. He feared that Zhang Jun would again encourage the military governors to attack him. He thus ordered Zhang Quanyi to kill Zhang Jun. Zhang Quanyi sent his officer Yang Lin () to take a group of soldiers, disguised as bandits, to attack Zhang Jun's mansion and slaughter his household. Only Zhang Jun's son Zhang Ge escaped the slaughter. Subsequently, Zhu Quanzhong destroyed Chang'an and moved Emperor Zhaozong to Luoyang. He then moved Zhang Quanyi to be the military governor of Tianping Circuit (天平, headquartered in modern Tai'an, Shandong. He also had Zhang created the Prince of Dongping. In 904, by which point Zhu had assassinated Emperor Zhaozong and replaced him with his son Li Zuo the Prince of Hui (as Emperor Ai), Zhang Quanyi was again made the mayor of Henan; he was additionally also made the military governor of Zhongwu Circuit (忠武, headquartered in modern Weinan), apparently commanding it remotely, and the overall commander of the imperial guards. During Later Liang During Emperor Taizu's reign In 907, Zhu Quanzhong had Emperor Ai yield the throne to him, ending Tang and starting a new Later Liang as its Emperor Taizu. He made Zhang Quanyi the military governor of Heyang, in addition to being the mayor of Henan, again, and created him the Prince of Wei. Soon thereafter, he changed Zhang Quanyi's name to Zhang Zongshi, apparently due to naming taboo as his own name included the character "Quan." In 908, in addition to his other offices, Zhang was also made Taibao () and the military governor of Zhenguo Circuit (鎮國, headquartered in modern Sanmenxia, Henan). In 910, he was additionally made the military governor of Xuanyi Circuit (宣義, headquartered in modern Anyang, Henan. In 911, Emperor Taizu spent the summer at Zhang's summer mansion. He used the opportunity to have sexual relations with virtually every woman in Zhang's household. Zhang's son Zhang Jizuo (), humiliated, wanted to assassinate the emperor. Zhang Zongshi pointed out that it was because of