Question : Make email address UPN name for multi-domain forest

I have 2 domain trees in my win2003 forest.  
Domain A.com  and DomainB.us
My users currently have 2 separate UPN names due to the multi-level domain forest:
[email protected]
[email protected]
Their email addresses are:   [email protected]
I would like to have all my users in every domain have a UPN that matches their email address. Is this possible? Can it be scripted?
The goal is to have all users in each domain use their email addresses (UPN name) to log-in and authenticate to our intranet site etc.

Answer : Make email address UPN name for multi-domain forest

Here you go. Make sure "get-aduser -filter {logoncount -gt 1} -searchscope subtree -searchbase "dc=domain,dc=com" | foreach {$account = $_.samaccountname" is on a single line when you run this. Best to save it as a ps1 file from the text editor. The "dc=domain,dc=com" is your domain name. So if the domain you want to run this on is random.local, the values in the quotes will be "dc=random,dc=local" .
For your subdomain, you'll need to add another dc= in there, so double.random.local is "dc=double,dc=random,dc=local"
I set it up so it will prompt you for the UPN suffix. Do not use the @, just the random.com part. The script will put the @ in there.
You may also need to be logged in as the Domain Administrator for the domain you run this on. I got some errors when I ran this as a regular user that was a member of the Domain Admins group. It ran fine as the default domain administrator account, though.
1:
2:
3:
4:
write-host "Enter UPN Suffix"
$upn = read-host
get-aduser -filter {logoncount -gt 1} -searchscope subtree -searchbase "dc=domain,dc=com" | foreach {$account = $_.samaccountname
set-aduser -identity $account -userprincipalname "$account@$upn"}
Random Solutions  
 
programming4us programming4us