Solved

copy attribute "office" to exchange custom attribute 1

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

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 71

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

Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

Question has a verified solution.

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

This article will help you understand what HashTables are and how to use them in PowerShell.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

740 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