Knowledge Base

How to transfer data between Active Directory attributes in bulk

Problem:

You use an attribute which is not supported by CodeTwo Email Signatures for Office 365. You would like to find an automated way to make a value stored in this attribute available for use in our software as a placeholder.

Solution:

Let’s assume that you have an academicTitle attribute which you use to store an academic title for each user in your organization. It is a local (on-premises) attribute, so you use the Azure Active Directory Connect tool to synchronize it with the cloud (Microsoft 365). Unfortunately, after extending schema, completing the sync, etc., you are still unable to select the attribute in the signature template editor because it is simply not there. Copying attribute’s value to another attribute for each user manually is out of question because there is a large number of users in your organization.

Instead, the best option for this scenario is as follows:

  • Choose another attribute that can be used by CodeTwo Email Signatures for Office 365. A good candidate is one of the local extension attributes, e.g. extensionAttribute1, because it does not require you to extend the Active Directory schema and, once you sync it to Azure AD, is mapped directly to CustomAttribute1 which you can access in our signature template editor.
  • Next, copy values from the unsupported attribute (academicTitle) to extensionAttribute1 in bulk by using PowerShell to later sync it to the Microsoft 365 cloud. 

Read on to learn how to do it in detail:

  1. Log in to any server machine in your Azure Directory domain, using the admin account.
  2. Open the PowerShell console (for example by clicking Start and typing powershell).
  3. Use the following script:
    $users = Get-ADUser -Filter * -Properties *|Where-Object {$_.academicTitle -ne $null }| Select-Object sAMAccountName,academicTitle
    
    foreach($user in $users) {Set-ADUser -identity $user.sAMAccountName -add @{extensionAttribute1=$user.academicTitle}}
    

    Info

    If you want to copy an attribute value for selected users only, replace the asterisk (*) after the -Filter switch with an appropriate query code. Learn more

    Once the script is executed, the value stored in the academicTitle attribute for each user in your organization will be automatically copied to extensionAttribute1 for the same user.

  4. Sync the local AD attributes with the cloud by using the Azure Active Directory Connect tool.

Now that all the data is synced, you will be able to insert an academic title of your user by using the CustomAttribute1 attribute in the signature template editor of CodeTwo Email Signatures for Office 365 (Fig. 1.).

Inserting the CustomAttribute1 placeholder into a signature template.
Fig. 1. Inserting the CustomAttribute1 placeholder into a signature template.

See also:

Was this information useful?