Solved

setting Target address in user Attribute

Posted on 2016-11-23
5
27 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:Andy Navi
  • 3
  • 2
5 Comments
 
LVL 4

Author Comment

by:Andy Navi
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 36

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 4

Author Comment

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

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 4

Author Closing Comment

by:Andy Navi
ID: 41900283
Thank you so much
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Disabling the Directory Sync Service Account in Office 365 will stop directory synchronization from working.
This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
In this video we show how to create a Distribution Group 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 >>…
To show how to generate a certificate request 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 Servers >> Certificates…

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now