With something like this, the absolute bare minimum you would want to do is set up several accounts and create profiles and mailboxes, etc. for them and then run the script just on those users and see what happens. Aside from technical challenges you'll want to look for how the user experience is affected.
If you have services for which you don't know what will happen when you do this, you need to test those services specifically. Make a test user, change the username, go through everything to see what breaks. Find out how to make it not break or how to fix it right away so you know what you have to do so things keep working when you do this to a real user.
If you change a username (the word I will use for short to include both the SAM account name and UPN) for a Windows user while they are logged on, I'm pretty sure their security tokens become instantly invalid and all kinds of unexpected behavior can occur. If you haven't done this before, you should definitely go through the process of just changing a single username for a user so you see what happens.
This is the kind of thing that has to be done from time to time when people change names due to marriage, so it's doable. I think the challenge will be trying to do it for everyone all at once.