You want to import objects into Active Directory using an LDIF file. The file could contain object additions, modifications, and/or deletions.
To import objects using
the ldifde
utility, you must first create an LDIF
file with the objects to add, modify, or delete. Here is an example
LDIF file that adds a user, modifies the user twice, and then deletes
the user:
dn: cn=jsmith,cn=users,dc=rallencorp,dc=com changetype: add objectClass: user samaccountname: jsmith sn: JSmith useraccountcontrol: 512 dn: cn=jsmith,cn=users,dc=rallencorp,dc=com changetype: modify add: givenName givenName: Jim - replace: sn sn: Smith - dn: cn=jsmith,cn=users,dc=rallencorp,dc=com changetype: delete
Once you’ve created the LDIF file, you just need to
run the ldifde
command to import the new objects.
> ldifde -i -f input.ldf
For more information on the LDIF format, check RFC 2849.
Recipe 4.24 for information on LDIF, RFC 2849 (The LDAP Data Interchange Format (LDIF)—Technical Specification), and MS KB 237677 (Using LDIFDE to Import and Export Directory Objects to Active Directory)
Get Active Directory Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.