Solved

copy attribute "office" to exchange custom attribute 1

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
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).
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…
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…

828 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