Praise be to Allah.
If he does that before entering ihraam, there is nothing wrong with that, unless he wants to offer a sacrifice and the month of Dhu’l-Hijjah has begun, in which case that is not permissible for him, because the Messenger (peace and blessings of Allaah be upon him) forbade that. As for doing that after ihraam, i.e., after making the intention to enter ihraam, that is not permitted at all, because the pilgrim in ihraam is not allowed to cut his nails or remove any of his hair until he has finished his Tawaaf and Sa’ee for ‘Umrah, when he exits his ihraam by shaving his head or cutting his hair, and likewise in Hajj when he has stoned Jamarat al-‘Aqabah, when it is prescribed for him to shave his head or cut his hair, but shaving is preferable. Then he exits ihraam whether that was before offering the sacrifice or afterwards, although it is preferable to do that after the sacrifice, if possible.
And Allaah is the Source of strength. May Allaah send blessings and peace upon our Prophet Muhammad and his family and companions.