Solved

setting Target address in user Attribute

Posted on 2016-11-23
5
144 Views
Last Modified: 2016-11-24
Hello Team,

I have a list of users with SAM account name in CSV file and i need to update corrospond target address that is different for every user

Could you please suggest, how we can do it

Thanks,
Andy
0
Comment
Question by:Addy Nadia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 5

Author Comment

by:Addy Nadia
ID: 41899186
like as a example.

if i have sam account name for below user

tadams  Target address is torrey.adams@xyz.com

So xyz.com is same for all user in target user but firstname.lastname is different

Thanks,
Andy
0
 
LVL 37

Accepted Solution

by:
Jian An Lim earned 500 total points
ID: 41900069
your csv file looks like his

samaccountname,targetaddress
tadams,torrey.adams@xyz.com

Open in new window



on your AD server you can run the following command

$file = import-csv c:\temp\user.csv 

foreach ($f in $file) {
get-aduser $f.samaccountname 
$targetaddress = $f.targetaddress

# set-aduser $f.samaccountname -add @{targetAddress = $_.targetAddress}
}

Open in new window

0
 
LVL 5

Author Comment

by:Addy Nadia
ID: 41900191
thanks so much, instead of set, suppose i want to check with GET command how to do that
0
 
LVL 37

Expert Comment

by:Jian An Lim
ID: 41900269
Sure

$file = import-csv c:\temp\user.csv 

foreach ($f in $file) {
get-aduser $f.samaccountname -properties targetaddress | select samaccountname,targetaddress

}

Open in new window

0
 
LVL 5

Author Closing Comment

by:Addy Nadia
ID: 41900283
Thank you so much
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows 10 came with  a lot of built in applications, Some organisations leave them there, some will control them using GPO's. This Article is useful for those who do not want to have any applications in their image (example:me).
Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
In this video we show how to create a Contact in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Contact ta…
To show how to create a transport rule in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Rules tab.:  To cr…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question