KB N°1: Easily import Active Directory users into an awareness campaign

Published May 30, 2024

Context

The aim of this article is to show you how to import your Active Directory users into an Olfeo Awareness campaign, simply and in just 3 steps.

Prerequisites

Make sure that the Active Directory module for PowerShell is installed on your server or machine where the Active Directory is located. If this is not the case, you can install it by referring to the following documentation.

Step 1: Open PowerShell as administrator

On your server or machine where Active Directory is installed, open PowerShell as administrator.

Step 2: Retrieve user information

To launch a campaign in Olfeo Awareness, we need to retrieve the e-mail address, first name and surname of each participant. In an Active Directory, this data generally corresponds to the attributes userPrincipalName, givenName and surname.

Depending on your directory configuration, you may need to use other attributes instead.

Use the Get-ADUser command to retrieve users and select the desired attributes (userPrincipalName, givenName, surname):

$users = Get-ADUser -Filter * -Property userPrincipalName, givenName, surname | Select-Object userPrincipalName, givenName, surname

Step 3: Export user information to a CSV file

Export the recovered data to a CSV file with the following command:

$users | Export-Csv -Path "C:\path\to\your\directory\Listeparticipants.csv" -Delimiter ";" NoTypeInformation

Once you've retrieved the CSV file, replace userPrincipalName, givenName and surname in the first line with email, first_name and last_name.

Now you're ready to import the desired participants into an awareness campaign!