Tool

jimsc's picture
tool
Reads:

2630

Score:
0
0
 
Comments:

0

Bulkmod.pl

Author Info

22 December 2005 - 10:20am
Submitted by: jimsc

license: 
Free

I've run into a number of customer issues where we had to update thousand of entries with the exact same attribute and value. In each case, I had to write an LDIF file. A co-worker gave me a clever idea. Create a utility which allows you to populate (or remove) attributes without an LDIF.

You can run the utility in one of two ways. You can specify one attribute and value, on the command line, to be added. Alternatively, you can specify a file with multiple attributes and values. The rest of the syntax is just like ldapsearch - a bind DN, a password, a search base and filter. The utility will apply the change to all entries that match the filter under the specified search base.

In order to run it, you'll need Perl and the Net::LDAP module. On NLD or SLES, you can just load perl-ldap to get this module. You can also set it up on Windows, but you'll have to download the module from www.cpan.org .

Here's the syntax:

# Gives you verbose help instructions
$ bulkmod.pl --help
OR
$ bulkmod.pl -h <host> -D <user> -w <password> -b <base> -m [add|del|rep] -a <attr>
 -v <value> <filter>
OR
$ bulkmod.pl -h <host> -D <user> -w <password> -b <base> -m [add|del|rep] -f <file>
 <filter>
Where the file is in this format:
<attr>,<value>
<attr>,<value>
Examples:
$ ./bulkmod.pl -h sammy -D cn=admin,o=novell -w novell -b o=novell -m add -a title -v
 TSE "objectclass=user"

$ ./bulkmod.pl -h sammy -D cn=admin,o=novell -w novell -b o=novell -m del -f changes
 "objectclass=user"

AttachmentSize
bulkmod.zip1.56 KB




User Comments

Post new comment

Anonymous
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <p> <a> <em> <i> <cite> <code> <img> <ul> <ol> <li> <div> <dl> <dt> <dd> <b> <strong> <h1> <h2> <h3> <pre> <table> <td> <tr> <th> <blockquote>
  • Lines and paragraphs break automatically.
  • Glossary terms will be automatically marked with links to their descriptions. If there are certain phrases or sections of text that should be excluded from glossary marking and linking, use the special markup, [no-glossary] ... [/no-glossary]. Additionally, these HTML elements will not be scanned: a, abbr, acronym, code, pre.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
3 + 0 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

© 2012 Novell