Update Country Code Attribute

In this guide, I’ll show you how to update the Country Code attribute in Active Directory using the AD Pro Toolkit.

When you change the Country/region settings for a user account in Active Directory it will actually update three attributes.

  • c
  • co
  • countryCode

You can view these attributes with the Attribute Editor.

To bulk update the countryCode requires setting these three attributes for each user.

Step 1: Get the country code from the ISO website

Get the c and countryCode values from the ISO country code page. You must use these ISO 3166 country codes or the update could fail.

Searching the website for the United States I find “US” for the c attribute and “840” for the countryCode. The co attribute can be anything so I’ll use “United States”.

If any of these 3 attributes are missing the update will fail, this is also true if using PowerShell.

Step 2: Setup CSV file

Download the provided CSV template from the user bulk updater tool. These attributes are already included in the template, you will need to add the users and values to be updated.

Above, is a screenshot of my CSV template, column A is the user accounts I want to update followed by the c, co, and countryCode attributes. Save your CSV file and move to step 3.

Step 3: Run Updater Tool

The last step is to run the Bulk Updater Tool. Select your CSV file and click the run button.

Check the logs for errors.

Above you can see I got an error on user Mikel.Johnson. Looking at the CSV this user is missing values for the c and countryCode columns. I did this on purpose to show you that all three attributes are required by Microsoft.

All done. That is how you bulk update the Country value in Active Directory.

To verify the country code attributes have updated run the all users report and include the c, co, and countrycode columns.