Update Mail and UserPrincipalName Attributes to be the same as ProxyAddress?


hello

i have ad environment imap mail system migrating office365.

i have script use add smtp addresses proxyaddresses attribute each user in ad. calls csv file have 2 columns - 1 heading "name" , 1 heading "proxy":

"import-csv file.csv | foreach {get-aduser $_.name | set-aduser -add @{proxyaddresses = ($_.proxy -split ";")}}"

i need users upn , mail attributes same primary smtp proxyaddress o365 userid, there way this? i've seen lot of examples in other blogs using quest management tools scripts

thanks


hi fred

thanks response. command work though, , has never thrown errors while entering in new proxy addresses required file (either in smtp: or smtp: format).

however, looking @ command line have replied with. tried play around command provided , replace values upn in way:

import-csv file.csv | foreach { $userprincipalname = $_.upn -split ";" ; get-aduser $_.name | set-aduser -add @{ userprincipalname = $userprincipalname } }


however threw me error immediately:

"set-aduser : multiple values specified attribute can have 1 value"

all did change "add" "replace" upn have 1 value. correct script now:

import-csv upntest.csv | foreach {get-aduser $_.name | set-aduser -replace @{userprincipalname = ($_.upn)}}


tested , works perfectly.

thanks in pointing me in right direction.

cheers

marooner



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

2008 Windows Deployment Server Properties Error

Can no longer user MS Update - Files required to use Microsoft Update are no longer registered

How do a find data in one file, search for it in another file and if not found, write a custom message to another file