Thanks. This is not an exchange environment.

On Apr 11, 2016, at 5:26 PM, Michael B. Smith 
<[email protected]<mailto:[email protected]>> wrote:

Inline below.

Now, that being said, that is not the proper way to update an Exchange email 
address.

From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]] On Behalf Of Marcum, John
Sent: Monday, April 11, 2016 4:43 PM
To: [email protected]<mailto:[email protected]>
Subject: [powershell] Easy Script to Set Email Address

I have the following little scrip that changes the UPN of users in AD. I’d like 
it to also set the email address value on the user account. The field is blank 
at this time and I’d like it filled in with the username + the $newSuffix. How 
about I do that?


$oldSuffix = 'corp.viamonstra.local'
$newSuffix = 'student2.info<http://student2.info>'
get-aduser -filter * | forEach-Object {
$newUpn = $_.UserPrincipalName.Replace($oldSuffix,$newSuffix)
$_ | Set-ADUser -UserPrincipalName $newUpn –EmailAddress $newUpn –Verbose }

________________________________
        John Marcum
               MCITP, MCTS, MCSA
               Desktop Architect
   Bradley Arant Boult Cummings LLP
________________________________
    <image001.png><https://mvp.microsoft.com/en-us/overview>
          <image002.png><http://mmsmoa.com/>


________________________________

Confidentiality Notice: This e-mail is from a law firm and may be protected by 
the attorney-client or work product privileges. If you have received this 
message in error, please notify the sender by replying to this e-mail and then 
delete it from your computer.

================================================
Did you know you can also post and find answers on PowerShell in the forums?
http://www.myitforum.com/forums/default.asp?catApp=1

================================================
Did you know you can also post and find answers on PowerShell in the forums?
http://www.myitforum.com/forums/default.asp?catApp=1


================================================
Did you know you can also post and find answers on PowerShell in the forums?
http://www.myitforum.com/forums/default.asp?catApp=1

Reply via email to