View All Blog Posts

Exporting & Updating Active Directory Computers

How to export and update computer information stored in Active Directory using Data Sync

Data Sync makes it possible for you to quickly and easily export computer information from your Active Directory. This can be especially useful for auditing purposes. You can also use the software to decorate your computer records with details such as an asset number or a description detailing the location.

The following page will cover how to export computer data from Active Directory to a target of your choice. We will also briefly cover updating records with additional data.

Active Directory Computers

Requirements

Before getting started you will need to ensure that you have the following:

  • Windows 10 or Windows Server
  • Downloaded & Installed Data Synchronisation Studio
  • Have access to Active Directory
  • Have a source dataset containing the computer information to add to AD

If you do not have Data Synchronisation Studio you can get a free evaluation edition.

Connect to your Active Directory

Start by opening Data Sync and connect to your Active Directory Computers. To do this click onto Connect Datasource in the target window and go to Active Directory > Active Directory V2 - Users/Contacts/Groups/Computers.

Select Computers from the DefaultAttributes drop-down menu, enter in the LDAP path to your Active Directory instance, and enter in any credentials you need to access AD.

The LDAP Path can be just your Server name or the path to a specific OU. For example connecting with just a Server Name would look like this: LDAP://dc01, and connecting to a specific OU would look similar to: LDAP://OU=Demo,DC=lab,DC-simego,DC=com. You can find more details on how to find your LDAP path here.

AD Connection Details

You can then click Connect & Create Library Connection to save the connection to the connection library. Just enter in a name for the connection and click OK. You can then refresh the connection window and your Active Directory connection will then be visible.

This only needs to be done once per OU as you will be able to access other objects such as Users and Contacts from the connection window.

Connect to your Target

You now need to connect to your target, this could be a SQL table, CSV file or another system. You can use any of the connectors to connect to your chosen file, table or system.

It is also possible to create a target table or file based off the columns added to the schema map. This can be a SQL table, SharePoint List, CSV, Excel or XML file to name a few.

To create these add the attributes you want to include from AD to the schema map. Then go to Tools and select the create option you need from the list.

Tools Menu

Now follow the instructions on screen to specify the connection or determine where to save the file.

Configure the Schema Map

Now you need to configure the schema map. If you haven't already, add the attributes from Active Directory that you want to export and match these to their corresponding column in the target.

Make sure to select a key column that is unique and can be used to identify each record. In this example we use DS-SAMAccountName as it is unique to each record.

Export Schema Mapping

Compare and Sync

Once you have all the columns mapped you can run the comparison to view the differences between the source and target. Do this by clicking onto the Compare A > B button in the toolbar.

Compare Button

This will open a tab where you can view actions that need to be made to make the target the same as the source. These may be a series of Add, Update or Delete actions, however delete is disabled by default. To enable deletes set the property EnableDelete to True on the target.

The results for this example show that there are 5 records to be added.

Compare Results

As the data looks as expected you can synchronise the results. To do this click Synchronise and then Start to begin the sync. The computer data will then be imported into your chosen target.

Synchronise

Quick Export Option

If you have saved your connection to Active Directory in the Connection Library you can quickly export your computer data to a CSV, Excel spreadsheet or XML file. Just right click onto Computers in your connection and select Preview Data, in the preview window you will then be able to access the quick export functions. Choose your preferred file type and type in a name for your export.

Preview Data

Export Data Options

You can also do this by connecting to your Active Directory Computers and adding the columns you want to the schema map. Then click Preview A and you can export the results to either a CSV, XML or Excel File.

Filtering the Results Returned

You can filter the results returned either by editing the LDAPFilter or by using the filter box.

You can enter an LDAP Filter in the connection properties, this can be found below the columns in the source window. Look for the property LDAPFilter and click onto the ellipsis in the field to open the editor. Edit the default filter to return only the results you need and click OK.

LDAP Filter

Now refresh the connection by clicking onto the refresh icon in the datasource toolbar and preview the results (Preview button in the datasource toolbar). Data Sync will now only return the data that matches your filter.

We have more details on how to construct an LDAP Filter in our documentation page here.

To use the filter box, which can be found directly below the columns in the source window enter in a C# function to filter your data.

You might filter for computers using a certain operating system, e.g. Windows Server 2019 Standard, so you could use the expression OperatingSystem == "Windows Server 2019 Standard".

Please note that column names must be in a C# friendly format i.e. not contain spaces or special character (except for underscores).

Filter Box Example

To apply the filter and check the data that is being returned click the Preview A button in the schema map toolbar. Using the example expression above either only the computers that have "Windows Server 2019 Standard" as a value in the OperatingSystem attribute will be returned.

Automate & Schedule

Now that you have configured your synchronisation from Active Directory to your target you have a couple of options available to automate the running of your projects.

Run via the Run Tool

The Run Tool is an additional program that comes linked to Data Sync and enables you to build out your data integration jobs.

You can use this to group Data Sync projects that need to run in order and add additional step types such as adding an status report to email you when the project has run and if there were any failures. Each step is run in the order it appears in the list and you can apply conditional rules so that the next step can run if the previous one succeeded or had data changes for example. To find out more please see our Run Tool Documentation.

To open your project in the Run Tool, in your Data Sync project go to Tools >Open in Run Tool.

Open in Run Tool

You can then click onto the green Run button to check it runs as expected. If there are data changes you will be provided with a count of how many items were added updated or deleted

Run Tool

Run via the Command Line

Another option is to Run the Run Tool project or single Data Sync project from the command line. To do this pass the path to the project file like this:

Run Tool Project

%DATASYNCINSTALLPATH%\Simego.DataSync.Run.exe -execute "D:\DSProjects\myproject.dsrun"

Data Sync Project

%DATASYNCINSTALLPATH%\Simego.DataSync.Studio.exe -execute "D:\DSProjects\myproject.dsprj"

Automate with Windows Task Scheduler

You can then schedule your Run Tool project to run when you need it to using Windows Task Scheduler. For the full details on how to do this see our Task Scheduler Documentation.

Automate with Ouvvi

An alternative option, with more scheduling capabilities is to use Ouvvi Automation Server. Ouvvi enables you to fully schedule and manage all of your Data Integration Projects, from Data Sync projects to SQL Statements to Powershell Scripts.

It provides full logging and documentation capabilities to fully manage your integration operations.

To find out more see our Ouvvi Documentation or send us an email.

Ouvvi Automation Server

Update Computer records in Active Directory

To add details to other attributes to your computer records you can set up a simple Data Sync project.

Your source data, with the details to add such as an asset number, needs to have something to identify each computer. This need to be unique, for example you could use the computer name or logon name (SAMAccountName).

Start by connecting to your source data and then connect your target (Data Source B) to your Active Directory Computers. You can find more details on how to do this in the section above or in our documentation here.

Add the columns from your source to the schema map and match them to their corresponding attribute in Active Directory. Make sure to set the key column that can be used to identify each computer.

Schema Map Update Computers

Then click Compare A > B to view the differences between the source and target and then click Synchronise and Start to sync the results to Active Directory.

For more ideas on how you can integrate with Active Directory checkout our AD Solutions page or our other blog posts.

| Friday, January 21, 2022 |

Recent Blogs