William Petrie was appointed as the Acting Governor of Madras Presidency on 11 September 1807. He was preceded by Lieutenant General Lord William Henry Cavendish-Bentinck, GCB, GCH, PC who served as the Governor of Madras Province from 30 August 1803 to 11 September 1807. The Madras Presidency, also known as the Presidency of Fort St. George and Madras Province, was an administrative sub division of British dominated India. The territory included most of southern India, such as the modern states of Tamil Nadu, the Coastal Andhra and Rayalaseema regions of Andhra Pradesh, Lakshadweep Islands, the Malabar region of North Kerala, Koraput, Malkangiri, Nabarangapur and Gajapati districts of southern Orissa and the Bellary, Ganjam, Dakshina Kannada, Rayagada and Udupi districts of Karnataka. Madras (now Chennai) was the winter capital of the province and Ootacamund (now Ooty) was the summer capital of the British presidency.
Petrie established a private observatory at his residence in Egmore, Madras (now Chennai) in British India. Later he gave the observatory to the British East India Company. This was the first modern astronomical observatory outside Europe. The observatory was eventually named as the Madras Observatory, situated in Nungambakkam. The British East India Company appointed Michael Topping as the astronomer in the observatory. The Madras Observatory later developed into the Indian Institute of Astrophysics.
William Petrie served in office until 24 February 1808 and was succeeded by Sir George Hilaro Barlow, 1st Baronet GCB, who acted as the Governor of Madras from 24 February 1808 to 21 May 1813. Later he was assigned as Governor of Prince of Wales Island (Penang Island) in the year 1809. He died in the year 1816.