Is it permissible to invite a Rabbi to affix a Mezuzah in your new home?

Ha’Rav Ovadyah Yosef (a”h) addresses this question in his Sefer Halichot Olam. He writes that it is indeed permissible to invite a Rabbi to affix the mezuzot, but in such a case the text of the berachah changes. Before placing the Mezuzot, the Rabbi would recite a slightly different berachah. The Rabbi would say, “Baruch atah Hashem… Al Keviyat Mezuzah,” rather than the standard text of “Li’kbo’ah Mezuzah.” Therefore, one who affixes a Mezuzah on behalf of another recites the berachah of “Al keviyat mezuzah” instead of “Li’kbo’ah Mezuzah.”

A similar halachah applies with regard to the obligation of Ma’akeh. One who lives in a home with an accessible flat roof bears the obligation to place a Ma’akeh, (a parapet), around the roof so that nobody will fall from the roof. When one places the Ma’akeh, he recites the berachah, “Baruch atah… La’asot Ma’akeh” (“to make a parapet”). If however, one hires a Jewish worker to build the Ma’akeh for him, then the worker recites the berachah, “Baruch atah… Al asiyat Ma’akeh.” In this case too, the text of the berachah depends on who performs the mitzvah. If the homeowner performs the mitzvah, then the text of the beracha reads “La’asot…,” whereas if somebody else performs it on his behalf, then the text becomes “Al asiyat…”