How to export users and groups from Active Directory with ldifde

ldifde exports users, groups and their attributes to LDIF files that Samba AD, FreeIPA and OpenLDAP can read, once AD-only attributes are removed. Passwords never come with the export, so plan for them separately and verify every object against the source.

On this page

How to export users and groups from Active Directory before a move

A team moving identity data out of Active Directory, whether ahead of a renewal, a Windows Server lifecycle change or a move to Samba AD, FreeIPA or OpenLDAP, can start with ldifde, the command-line tool that ships with the AD DS or AD LDS role. Its default mode is export, so it writes user and group data to LDIF files, and passwords do not travel with the export. Password hashes are not readable through a standard directory export, so every user will need a new credential or a reset path on the target. Plan that step before cutover rather than discovering it during the first test login.

The export covers the objects and attributes you select: users, groups, memberships and the attributes you choose to keep, such as names, mail, department and account state. Use the -o option to omit listed attributes so the file can be loaded into another LDAP directory, and the -m option to omit attributes that only apply to Active Directory objects, such as objectGUID, objectSID, pwdLastSet and samAccountType. Run a small test export against a non-production OU first, then open the LDIF and confirm that nothing you need was dropped by a filter. Treat the output as a data copy, not a complete backup of the domain: it does not capture Group Policy, SYSVOL, DNS zones or the Kerberos keys that the new platform must regenerate. Ask the target platform's team which attributes it expects and check the result against the source with counts per OU and a sample of named accounts.

What ldifde can export from Active Directory

This table compares the three kinds of directory data you need to carry into Samba AD, FreeIPA or OpenLDAP: user objects, group objects and organizational unit paths. Read each row for the export method, the output format and the limits that apply before you run anything. The main takeaway is that ldifde writes LDIF and can strip AD-only attributes, but the exact filter and attribute list depend on your domain, so confirm them against the Microsoft Learn ldifde reference for your server version.

Data typeExport methodOutput formatLimits to confirm
User objects and attributesldifde in default export mode, with a search filter for user accounts and an attribute list set by the command optionsLDIF text file, one entry per objectUse -o to omit attributes the target LDAP directory does not accept, and -m to omit AD-only attributes such as objectGUID, objectSID and pwdLastSet
Group objects and membershipldifde export with a filter for group objects, keeping the member attributeLDIF text file, with membership written as member attribute valuesConfirm that member values use distinguished names your target directory can resolve, and that nested groups are represented as you expect
Organizational unit pathsldifde export of organizational unit objects, which show where users and groups sit in the treeLDIF text file, with distinguished names that encode the OU pathConfirm that the target directory base DN and OU layout match the source before import, since distinguished names carry the path
PasswordsNot exported by ldifde as usable password dataNo password hashes in the LDIF outputPlan a separate reset or sign-in method for users, because passwords do not come with the export

What does not come out of Active Directory and how to handle each gap

An ldifde export carries directory objects, attributes and group memberships, but several things that make an AD estate work stay behind. Each gap below needs its own decision before cutover, and the right workaround depends on which target you choose.

Password hashes and Kerberos keys

Passwords do not come with an ldifde export, and the Kerberos keys that AD derives from them are not exported either. Users must set new credentials on the target, or you coordinate a cutover that uses the target's own migration path. Confirm with the target's migration guide whether it can import existing hashes at all, and plan a user communication and help desk window for password resets if it cannot.

AD-only identifiers

Attributes such as objectGUID, objectSID, pwdLastSet and samAccountType only mean something inside Active Directory. Running ldifde with the -m option omits them, so the export can be loaded into another LDAP directory. The target assigns its own identifiers, so keep a mapping of old to new SIDs or GUIDs only if an application or ACL depends on them, and check that list before cutover.

Group Policy and SYSVOL content

Group Policy objects live partly in the directory and partly as files in SYSVOL, so an ldifde export captures only the directory side. Policy settings do not transfer in the same form to Linux directories. Inventory each GPO, then decide with the target's documentation whether to rebuild the settings in the target's configuration tools, keep Windows clients on a domain that still applies them, or retire them.

DNS zones and DHCP scopes

DNS zones and DHCP scopes are not part of the user and group export. Active Directory-integrated zones and DHCP configuration need their own export with the tools that run those services, such as the DNS management console or a DHCP export on the server. Record each zone, its dynamic update settings and each scope's options before any cutover, and confirm with the target which DNS backend and DHCP service it will use.

Group membership and nested groups

Membership is exported as attributes on each object, but nested groups and primary group settings can flatten or break when loaded into a different directory. Verify the imported result against the source by counting members per group and checking nested relationships on a sample. An illustrative check: compare a group with three nested subgroups in AD against the same group in the target before accepting the import.

Which export options fit Samba AD, FreeIPA or OpenLDAP as the target

Samba AD is an Active Directory-compatible domain controller, so it keeps most AD object classes and attributes. That makes it the target where the LDIF can stay closest to the source, but AD-only attributes still need a decision. Samba is administered with samba-tool, not with the Windows tools, so the users, groups and memberships you export must be recreated or imported through that command set and checked against the new domain.

  • Keep AD-shaped attributes: Most users and groups can be exported without the -m switch, because Samba understands AD object classes. Confirm which attributes Samba accepts before stripping any.
  • Plan the DN structure: Keep the source OU layout only if you plan to recreate it in the new domain. The domain DNS name and base DN will differ from the source.
  • Expect passwords to stay out: The export does not carry password material. Users must be re-provisioned with new credentials, or you must use a documented coexistence path.
  • Rebuild Group Policy and SYSVOL separately: LDIF covers directory objects only. Policy objects and their files need their own migration plan.
  • Check memberships after import: Use samba-tool to list group members and compare counts with the source export.

Before importing, confirm the target functional level and the attributes Samba supports for each object class in the current Samba documentation.

Export sequence: from a read-only pull to a verified LDIF file

This sequence produces a scoped, checksummed LDIF file of AD users and groups, with a recorded object count and schema context, and proves the file loads into a non-production target before any migration work depends on it.

  1. Confirm the ldifde tool and read access

    Confirm the server you export from has the AD DS or AD LDS role installed, so that the ldifde command is available. Sign in with a dedicated export account that holds only read permissions on the OUs and attributes in scope, not Domain Admin or Schema Admin rights. Run a simple query against one known OU to confirm the account can read objects. The step is done when the query returns the expected objects without an access error, and the account's group memberships are documented in your change record.

  2. Define the export scope in writing

    Decide which organizational units, security groups and attributes will leave Active Directory, and record each decision in a scope document that the migration owner and the security team approve. Include the search base, the object classes (users and groups), and any groups that must be excluded, such as service accounts or disabled stale accounts. Ask the security lead to confirm which attributes are personal data and whether they need to move at all. The step is done when the approved scope document exists and matches the filters you will use in the next step.

  3. Run a filtered test export to a file

    Run ldifde in export mode with a filter that matches only the scoped users and groups, writing to a file in a restricted working directory. Keep the test small, for example one OU, so the output is quick to review. Open the file and check that the first records show the expected distinguished names and that no objects from outside the filter appear. The step is done when the test file contains only in-scope objects and you have noted the filter string used.

  4. Remove AD-only attributes with explicit lists

    Rerun the export with the -m switch to omit attributes that only apply to Active Directory, such as objectGUID, objectSID, pwdLastSet and samAccountType, and use -o to list any other attributes that the target directory cannot accept. Keep the omit list in a version-controlled file so the same options run every time. Confirm in the output that the excluded attributes are absent. The step is done when a clean LDIF file exists and the omit list is saved with the run record. Passwords are not included in this export, so plan a separate credential reset or a supported password migration path for the target directory.

  5. Record counts and schema context

    Count the user and group entries in the source directory using a separate read query, then count the records in the LDIF file and compare the two numbers. Explain any difference, such as excluded disabled accounts, by pointing to the scope document. Record the forest and domain functional levels, the Windows Server version of the export server, and the date and time of the run. The step is done when both counts match or every difference is documented and approved.

  6. Store the file with access controls and a checksum

    Move the LDIF file to a restricted location that only the migration team can read, with encryption at rest and an access log where your platform supports it. Generate a SHA-256 checksum with a tool such as sha256sum and store the checksum separately from the file. Verify the checksum before any later step uses the file. The step is done when the checksum verifies after a copy to a second location, and the file's owner and access list are recorded. Delete temporary working copies once the test import is complete.

  7. Spot-check group membership against the source

    Pick a sample of groups, including nested groups, privileged groups and the largest groups, and compare their member lists in the LDIF file against Active Directory. Also spot-check several users for their key attributes such as userPrincipalName, mail and department. Note any group whose membership depends on a nested group or a foreign security principal, because these may not transfer intact. The step is done when every sampled group and user matches the source, and mismatches are logged with a decision on how to handle them.

  8. Run a test import into a non-production target

    Load the verified file into a non-production directory, such as a lab Samba AD, FreeIPA or OpenLDAP instance, using a test environment that is isolated from production networks. Check that the import completes without schema errors, then compare object counts and sample group memberships in the target against the source counts from the earlier step. Confirm the import can be repeated from the same file and checksum. The step is done when the target matches the scoped source, and any attributes the target rejected are recorded for the migration design.

How to check the exported file against the source directory

How do I confirm my object counts match the Active Directory source?

Compare the number of user, group and computer objects in the LDIF file with the number returned by an LDAP query run against the same domain, using the same filter you used for the export. Count entries by objectClass, not by total lines, because a single user record spans many lines. A count that is lower than the source usually means the export filter excluded objects, such as a base DN that stopped short of a child OU, or a filter that required an attribute some objects lack. A count that is higher often means the query picked up objects of a class you did not intend to move, such as contacts or service accounts. Record both numbers in your migration log so the comparison can be repeated after any re-export.

How do I check group membership and nested groups after an AD export?

Pick a sample of groups, including several that contain other groups, and compare their member lists in the export against a direct query of the source. Nested membership is the usual point of failure: a group that holds another group can show fewer effective members in the target if the nested group was exported without its own member entries or if the target does not resolve nesting the way Active Directory does. Check that each member DN in the export points to an object that is also in the file. Dangling references usually mean an object was excluded by the filter or sits outside the exported base DN. Decide before the move whether nesting will be flattened or preserved, because the target directory handles it differently.

Which user attributes should I verify before importing into the target?

Verify the attributes the target system and its consumers actually need, not every attribute the export contains. Typical examples are userPrincipalName, mail, department and the on-premises identifiers, such as sAMAccountName and the attributes used to link objects to other systems. For each attribute, check that the value is present on the same share of users you expect and that it matches the source for a sample of accounts. Blank values usually mean the attribute was not included in the export attribute list, or it is set only on some account types. Also confirm that you omitted AD-only attributes with the -m option as planned, and that no attribute you need was removed by an -o exclusion.

Why do multi-valued attributes like proxyAddresses or memberOf break imports?

Multi-valued attributes store several values under one name, and LDIF represents each value on its own line. Check that every value appears, that none were collapsed into one, and that the order and separators match what the target expects. Some attributes, such as proxyAddresses or otherMailbox-style lists, carry type prefixes that the target may reject or interpret differently. memberOf is computed by Active Directory from group membership and is not a value you should import as-is, so verify membership through the group entries instead. If a multi-valued attribute is truncated or merged, the usual cause is a line-folding or encoding issue in the export, which you can find by counting values per object on a sample of records.

How do I check accented names and character encoding in an LDIF export?

Open the file in a UTF-8 aware editor and search for a set of accounts with accented or non-Latin names, then compare their displayed values with the source in the Active Directory console or an LDAP query. Garbled characters such as doubled or replaced letters indicate the file was read or saved with the wrong encoding somewhere in the pipeline, not that the directory is wrong. Also check that LDIF values containing special characters or leading spaces were base64 encoded, since the import will fail or silently change them otherwise. Fix encoding at the export and transfer step and re-run the export before you import, so the target never holds a partial copy of names.

How should I handle disabled and expired accounts in the export?

Decide whether disabled and expired accounts move at all, then verify that the export matches that decision. Disabled accounts are represented by a flag in userAccountControl, and expiry is held in accountExpires, so check that these attributes are present for accounts you intend to keep and that the target can read them. Counting active and disabled users separately on both sides shows whether the export filter treated them as you intended. Most teams migrate only active accounts and archive the rest, so confirm the policy with the business owners and record the count of skipped accounts. Remember that the export does not carry passwords, so every migrated account will need a credential reset or a secure password transfer method on the target.

Why passwords do not come with the export and what to do instead

The ldifde export carries directory data, not the credential material a new directory needs to verify a password. The -o and -m options shape which attributes are written, but none of them turns a password into something another LDAP server can check. Attributes such as pwdLastSet are omitted by -m because they only describe Active Directory's own state, and the password hash itself is held in a form that the export does not produce. The practical result is that users cannot sign in to Samba AD, FreeIPA or OpenLDAP with their old passwords based on the export alone. Plan for this before the first import, and do not treat a successful import as proof that logins will work.

Three approaches are common, and the choice depends on the target. The first is a forced password reset at first login, where each account is created without a usable password and the user sets a new one. This is the simplest to reason about but needs a communication plan and a help desk ready for the cutover window. The second is a coexistence period, where Active Directory remains the authentication authority and the new directory holds only identity data until the team is ready to switch. The third is a documented cutover path specific to the target. For Samba AD, that means following Samba's domain join and Kerberos handling, which differs from a plain LDAP import. For FreeIPA, it means using its migration tooling, which regenerates Kerberos attributes instead of copying them. Confirm each option against the current documentation of the target, including the Samba wiki on setting up an AD DC and the FreeIPA migration how-to, before choosing.

What to plan before the Windows Server or Active Directory contract ends

The export itself is the easy part. Before running ldifde, teams need to settle which domain controllers are moving, how long the old and new directories run side by side, how exported files are kept and verified, and who can change accounts during the move. Each card below is a decision to make early, with the questions to put to a vendor or implementation partner.

Windows Server lifecycle per domain controller

Each domain controller has its own operating system version, support end date and hardware age, so the export plan depends on which servers stay and which retire. Map every DC to its lifecycle state before choosing a target. The sibling page on Windows Server 2016 extended support covers the timing decisions in detail. Ask the vendor or partner to confirm which functional level the current forest runs, since that limits which Samba AD or FreeIPA options apply.

Side-by-side running period

Source and target directories often run in parallel for weeks or months, so decide which system is authoritative for each attribute during that time. Decide whether passwords, group membership and account disablement sync in one direction or are managed separately. Ask the implementation partner to write down the cutover order and the rollback point before the first export runs.

Retention rules for LDIF files and checksums

Exported LDIF files contain personal data and group structure, so they need a defined owner, storage location, access list and deletion date. Record a checksum for each file when it is created and store it apart from the file. Confirm with your data protection and records teams how long exports are kept, and who approves deletion once the target directory is verified.

Change process for onboarding during the move

New hires, leavers and role changes keep arriving while the export is prepared, so a freeze or a dual-entry rule has to be agreed. Decide which system takes new accounts after the first export and how later changes are applied to the target. Without this rule, the final sync can miss accounts created or disabled after the snapshot was taken.

Rebuild of GPO and DNS settings

Group Policy objects, SYSVOL content, DNS zones and DHCP scopes do not come with an LDIF export, so each one needs its own inventory and rebuild plan. Decide which Group Policy settings the target can enforce and which must be redesigned. Ask your partner to confirm how DNS records and service principal names will be recreated and tested before any client is pointed at the new servers.

Skills and access to run the export

Running ldifde needs an account with read access to the directory, and the team needs someone who can review the attribute filters and check the output. Decide who holds the export account, how its use is logged and when its rights are removed. Confirm whether your internal staff or an implementation partner will validate the result against the source before any import.

Common questions about exporting data from Active Directory before a move

How much effort does an Active Directory export take?

The export itself is a short command run against the directory, so the effort lies in the preparation and checking around it. Four factors drive it: the number of objects and how many OUs they sit in, the depth of group nesting, how much attribute cleanup the target system needs, and how many target systems receive the data. Each target adds its own attribute mapping and its own verification pass. Attribute cleanup is often the largest share, because ldifde can omit listed attributes with -o and AD-only attributes with -m, but someone must still decide which attributes the new directory needs. Ask the implementation partner to split the estimate into discovery, export filters, mapping, verification and sign-off so each driver is visible.

Can our own administrators run ldifde without outside help?

Yes, a Windows administrator with directory read rights can run ldifde from a domain controller or a host with the AD DS or AD LDS tools installed. The export is the default mode of the tool, so basic exports need no special product. The harder part is knowing what to export and what to leave out: group nesting, filters that match the right OUs, service accounts, disabled users and attributes that Samba AD or FreeIPA will not accept. Teams that have done directory work before usually manage the export. Teams without that experience often need outside help for the mapping and the verification, which is where mistakes tend to surface after cutover.

How long does the export and preparation work take?

No fixed duration applies, because the length depends on the drivers of the work rather than the export command itself. Duration grows with the object count, the number of OUs and nested groups to reconcile, the number of attributes that need mapping, and how many rounds of test imports the target needs. Delays usually come from the business, not the tooling: waiting for group owners to confirm memberships, or for a change window to be booked. Ask for a schedule that lists each stage, its owner and the checkpoint that closes it, and confirm which stages a test environment must complete before production work begins.

What does the business need to decide before the export starts?

The business must name an owner for each group that will be migrated, because someone has to confirm that membership is still correct before it is moved. It also has to decide how users will authenticate after the move, since ldifde does not export password hashes and users will need a reset or another documented path. Finally, it must agree on change windows for the cutover and for any rollback. Without these decisions, the technical export can be correct and the migration still stalls. Record each decision in writing with a named approver before the export runs.

Is an ldifde export enough as a backup of Active Directory?

No. An ldifde export holds user, group and attribute data in LDIF files, but it is not a full domain backup. It does not capture the domain controller state, SYSVOL contents, Group Policy objects, DNS zones, or the directory's own recovery data needed to restore a domain. Keep your existing Windows system state and DC backups running until the migration is complete and retired. For what a complete backup and restore plan requires, read the backup questions on the sibling migration pages before relying on any export as a safety net.

What should we ask for in a written quote for this work?

Ask for a fixed scope written out in advance, with the list of OUs and groups to export, the target systems covered, and the attributes to be omitted or mapped. The quote should show deliverables for each stage: export filters, the mapping document, test imports, verification results and the sign-off record. Ask which parts are one-time work, such as the mapping and cutover, and which recur, such as support or upgrades after go-live. Confirm who performs the checks against the source directory, what evidence is delivered, and which assumptions about the business decisions would change the price or timeline.

How DeployOpen scopes and delivers an Active Directory export

DeployOpen treats the export of users, groups and attributes from Active Directory as a scoped piece of migration work, not a one-off command. The export is defined in writing, run inside your own environment, checked against the source directory, and handed over with the files and notes your target platform team needs.

How we scope

  • Confirm which OUs, groups and attribute sets the export covers, and which target directory receives them.
  • Agree the ldifde filter, the attributes to omit with -o and -m, and how service accounts are handled.
  • Record in the written scope that password hashes are not part of the export and how credentials will be reset.
  • Agree the checks, deliverables and timeline in writing before work starts, since most engagements are fixed-scope.

How we build

  • Run the ldifde export from a controlled administrative host with logging, using the agreed filters and attribute lists.
  • Review the LDIF output for AD-only attributes, multi-valued fields and group membership references before import.
  • Test the import into a non-production target such as Samba AD, FreeIPA or OpenLDAP and record every mismatch found.
  • Compare object counts, group memberships and key attributes against the source directory and document each difference.

How we hand over

  • Deliver the export files, filter definitions, attribute mapping and the reconciliation report as documentation.
  • Document the export procedure so your own staff can rerun it, with the exact steps and access required.
  • Walk through the open items, such as password reset plans and attributes that need a new home in the target directory.
  • Store handover material in your environment, so no copy of directory data stays with DeployOpen after the engagement.

How we support

  • Offer ongoing support, upgrades and continuous testing as a retainer if the migration runs over several phases.
  • Repeat the export and reconciliation before cutover, since directory data changes between the test run and go-live.
  • Confirm with your auditors which evidence of the export and checks they expect, since DeployOpen prepares evidence but does not issue audit reports.
  • Ask for a written quote that follows from the agreed scope, as DeployOpen does not publish a price list.

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.