It’s 100 years ago this year that the employment of imperial eunuch was abolished by the Nguyen Dynasty:

Eunuchs were key members of the Nguyen Dynasty court in Hué. They were the only men allowed inside the Purple Forbidden City serving the Son of Heaven, the emperor, alongside his wives and concubines. Eunuchs became quite powerful and would play off the concubines against one another. The castrated men, who wore green and red floral gowns with flat, oval hats, arranged the emperor’s night time activities and would be bribed by the concubines who wanted to be chosen for that night’s sexual adventure.

In 1836 Emperor Minh Mang limited their powers so they would not rise to the position of mandarin or become too powerful. He also graded their services. The premier eunuch (clerks) were paid 6 yuans and 0.8 quintals of rice (39.16kg); the lowliest were the errand boys who earnt one yuan and 0.2 of a quintal of rice (9.8 kg). Some saw this edict as a reaction to the courtier Le Van Duyet, who was himself a eunuch. The employment of eunuchs was abolished in 1914 by Emperor Duy Tan, who reigned between 1907 and 1916.

Quoted in my Footprint Vietnam guide