I guess I confused you.

It is right that they are trying to replace the service, not the profile.

Since they wanted to use the same exchange server name, I thought there would be no need to replace services or change the mail setting from the control panel. (I don't know much about Exchange server)

But they found that somehow they had to reconfigure the service( manually remove the current service and add a new server with the same server name to the current profile through the mail setting properties in contraol panel) to make outlook recognize the new server.

So that is why they want me to write some script that actually simulates the effects that happened when they did it manually by hand.