Remove the "-Properties userPrincipalName" from the command.

On Tue, Jul 26, 2016 at 9:27 PM, Heaton, Joseph@Wildlife <
[email protected]> wrote:

> 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:
>
> [image: SaveOurWater_Logo] <http://saveourwater.com/>
>
> SaveOurWater.com <http://saveourwater.com/> · Drought.CA.gov
> <http://drought.ca.gov/>
>
>
>



-- 
T. Todd Lemmiksoo

Reply via email to