Solved

copy attribute "office" to exchange custom attribute 1

Posted on 2014-03-28
3
501 Views
Last Modified: 2016-05-06
I am in need of a script to batch copy an AD user's "office" field into "ExchangeCustomAttribute1" for that same user.

I've found this page: but it is for AD and not exchange:

http://blogs.technet.com/b/ashleymcglone/archive/2012/07/23/how-to-copy-user-attributes-to-another-field-with-powershell.aspx

I'm looking for some help to get this written. Any ideas?
0
Comment
Question by:lbc_matt
  • 2
3 Comments
 
LVL 70

Accepted Solution

by:
Chris Dent earned 500 total points
ID: 39963681
Exchange lives in Active Directory, changes you make there will be reflected in Exchange. You just need to know the LDAP names of the attributes you have in mind. Those are:

Office = physicalDeliveryOfficeName
Exchange Custom Attribute 1 = extensionAttribute1

Which means you should be able to do this:
Get-ADUser -LDAPFilter '(physicalDeliveryOfficeName=*)' -Properties physicalDeliveryOfficeName, extensionAttribute1 |            
  Select-Object * -First 5 |            
  ForEach-Object {
    Set-ADObject -Identity $_.DistinguishedName -Replace @{extensionAttribute1=$($_.physicalDeliveryOfficeName)}
  }

Open in new window

Note: You will need to run "Import-Module ActiveDirectory" and either run it on a system with admin tools already installed, or install RSAT.

HTH

Chris
0
 

Expert Comment

by:DENG225
ID: 41582079
When I execute this script nothing happens and I am left looking at a flashing cursor?
0
 
LVL 70

Expert Comment

by:Chris Dent
ID: 41582161
Left at a ">>" prompt? If so, press return again and it should start running.

Chris
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Utilizing an array to gracefully append to a list of EmailAddresses
The article will show you how you can maintain a simple logfile of all Startup and Shutdown events on Windows servers and desktops with PowerShell. The script can be easily adapted into doing more like gracefully silencing/updating your monitoring s…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

744 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

14 Experts available now in Live!

Get 1:1 Help Now