Follow

Exporting your data from Active Directory (AD)

 

As a first step to getting your data into Jostle you might want to export it from AD.

Here is what you need to know:

  • It's a one-way export. Jostle never modifies data in AD, although you can export a CSV from Jostle and import it into AD manually if you ever need to.
  • The import only creates new users in Jostle, or updates existing ones - it never deletes people.
  • Any fields with blank values or missing columns are simply ignored, so you can decide which fields you push to Jostle without deleting existing data in Jostle.

The process requires two steps, both of which can be scheduled:

1. Export the data from AD to a CSV file
2. Upload that CSV into Jostle

 

1. Export the data from AD to a CSV file

There are two options:

Option A

You can do this with CSVDE or any other tool you want like VBScript, powershell, SSIS - anything that can create a CSV from AD. CSVDE is included with AD, so you can run something like this from the command line on your AD server:

csvde -d "cn=Users,dc=saml,dc=jostle,dc=com" -r "(objectClass=person)" -f contributors.csv -l "dn,cn,givenName,sn,title,mail,mobile,telephoneNumber,department" -s localhost

The -r filter and the -d (distinguished name) are likely to be different based on your settings. If you want to have this happen automatically put it in a batch file and schedule it to run once a day (or whenever).

Option B

You can use Get-ADUser command using PowerShell. Here’s an example:

Get-ADUser -filter * -properties givenName,sn,userPrincipalName,telephoneNumber |
select-object givenName,sn,userPrincipalName,telephoneNumber | Export-Csv -Path C:\exportUsers\jostleContributors.csv -NotypeInformation

-filter * = get information from all the different tabs in an AD User’s account

-properties = which fields from AD you’d like to export

-select-object = what order you’d like them to appear in the export

Export-csv = the type of file you’d like the export to be in (Jostle only accepts CSV files)

-Path = where you’d like the export to be stored. It needs to include the file name

-NoTypeInformation = removes an AD header that would appear in your export file

You can save this in a file as .ps1 and run it whenever you want.

If you want to export your data automatically put it in a batch file and schedule it to run once a day (or whenever).

 

2. Upload the CSV into Jostle 

Once Step 1 has succeeded, you can import the resulting CSV file into Jostle by following the instructions here.

You can also automate your import via SFTP.

Alternatively, if you already have an SFTP account, you can create a script file and set up a task to automatically upload your files as follows:

Uploading files to your SFTP Account (for Windows)

For this you'll need to:

  • Create a .txt file that will contain the script
  • Create a .bat file which will run the script
  • Create a task to run your .bat file on a schedule

 

1. Create a .txt file that will contain the script

Here's an example:

option batch abort
option confirm off

open sftp://username@sftp.jostle.us -privatekey="C:\Keys\privateKeyToSFTP.ppk"
put C:\exportUsers\jostleContributors.csv /jostle/input/
exit

username = the username we provided to you once your SFTP account was created

path to private key = the path to where your private key is stored (put the private key path inside the quotations)

local drive path = the path to where the upload .csv files are held (don’t put the local drive path in quotations)

 

2. Create a .bat file which will run the script

In this example we’re using WinSCP to connect to our SFTP server. If you want to use WinSCP you need to install it in your server.

"C:\Program Files (x86)\WinSCP\WinSCP.com" /script=script.txt

 

3. Create a task to run your .bat file on a schedule

  1. Open Task Scheduler
  2. Once it's open, click Create Task
  3. Go through the tabs of the Task Setup:

Task Setup

1. On the General tab:
     i. Add the Name of the Task
     ii. Modify any of the security option (if necessary)
2. On the Triggers tab:
     i. Click “New”
     ii. Schedule the frequency and time you’d like the script to run
3. On the Actions tab:
     i. Click “New”
     ii. Choose the “Action” as “Start a program”
     iii. In the Program/script section, search for the .bat file you created
4. The Conditions & Settings tabs are optional

Once you have finished configuring the task click OK.

 

Fields

To make sure that the fields from AD get matched up properly with Jostle’s fields you’ll need to create a mappings.csv file with the LDAP attributes in the first column and the corresponding Jostle fields in the second column. NOTEIf using SFTP, the mappings file will be stored in the “config” folder. 

Example:

mail,Username
mail,WorkEmail
givenName,FirstName
title,LastName

 

Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.