He was the son of the prominent Ghaznavid vizier Ahmad Shirazi, who was the son of Abu Tahir Shirazi, a secretary under the Samanids, whose family was originally from Shiraz in southern Iran. In 1077/8, Abd al-Hamid was appointed by Sultan Ibrahim as his vizier, and after the latter's death in 1099, continued to serve as vizier under his son Mas'ud III until 1114/5. After a brief dynastic struggle between some Ghaznavid princes, a son of Mas'ud III, Arslan-Shah, emerged victorious and became the new ruler of the Ghaznavid Empire. However, Arslan-Shah's reign turned out short; his mother, a Seljuq princess named Gawhar Khatun was treated badly, which resulted in her brother Ahmad Sanjar to invade Arslan-Shah's domains, where he managed to decisively defeat Arslan-Shah and make the latter's brother Bahram-Shah the new ruler of the Ghaznavid dynasty, while at the same time acknowledging Sejluq suzerainty. Abd al-Hamid, who was a supporter of Arslan-Shah, was probably killed during this struggle.
Abd al-Hamid had a son named Muhammad, who in turn had a son named Abu'l-Ma'ali Nasrallah, who became prominent at the Ghaznavid court as an excellent poet and statesman, and eventually became the vizier of Sultan Khusrau Malik.