I recently found a problem while doing method 1
"This command is not allowed in user build"
So the solution for that is:-
When we are writing
AT+EGMR = 1,7,”IMEI_code”
we have to give a space b/w AT and +
so final command will be like this
AT +EGMR=1,7,"IMEI_code"
Hit thanks if it worked for u :)