Bulk update of User Principal Names in AD

Recently I’ve been managing Active Directory on some dev and test environments, and scripted the creation of a large number of users. Unfortunately when creating some users I’d not changed the UPNs as required when moving across environments, and AD happily allowed me to create these users with invalid UPNs. The users had been issued ...