WindowsEmailAddress or PrimarySmtpAddress are probably what you want.
From: [email protected] [mailto:[email protected]] On
Behalf Of Heaton, Joseph@Wildlife
Sent: Tuesday, July 26, 2016 10:27 PM
To: 'NT System Admin Issues Discussion list'
Subject: [NTSysADM] Powershell help
I'm trying to set my users' userPrincipalName to be the same as the
emailaddress. Here's the snippet I'm trying to use:
Get-ADUser -Filter * -SearchBase 'ou=xxx,ou=xxx,ou=xxx,dc=xxx,dc=local'
-Properties userPrincipalName | foreach { Set-ADUser $_ -UserPrincipalName
"$($_.emailaddress)"}
I know that last bit is wrong, I keep getting errors. I've tried as-is, and
$($_.emailaddress)}
Anyone have any advice? I can't think of any other attribute that has the same
format as the email address (first.last).
Joe Heaton
Information Technology Operations Branch
Data and Technology Division
CA Department of Fish and Wildlife
1700 9th Street, 3rd Floor
Sacramento, CA 95811
Desk: (916) 323-1284
Every Californian should conserve water. Find out how at:
[SaveOurWater_Logo]<http://saveourwater.com/>
SaveOurWater.com<http://saveourwater.com/> *
Drought.CA.gov<http://drought.ca.gov/>