Solved

copy attribute "office" to exchange custom attribute 1

Posted on 2014-03-28
3
512 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
This article will help you understand what HashTables are and how to use them in PowerShell.
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

863 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

24 Experts available now in Live!

Get 1:1 Help Now