Tool

skoltogyan's picture
tool
Reads:

3136

Score:
0
0
 
Comments:

0

Change Telephone Numbers

Author Info

2 November 2006 - 2:30pm
Submitted by: skoltogyan

license: 
Free
For mass modification of telephone numbers from the console of server NW6.5 need prepare file sys:a.cvs in this format:

If using Russian (CP1251):

......

if using English:
"Koltogyan Sergey Rubenovich";"1300"
"Putin Vladimir Vladimirovich";"0001"
.....

If you prepare this file in CP1251 - all will work without any changes, if prepared in English, you need correct string 95:

Line 95 was:
from_to($lnameutf,"cp1251","utf-8");
Line 95 change to:
# from_to($lnameutf,"cp1251","utf-8");

This Steps for use scripts:
  1. Copy ct.pl to the sys:\perl\scripts\ct.pl
  2. Create folder: sys:\results\chngtlph
  3. Create empty file: sys:\results\chngtlh\chngtlh.log
  4. Modify script for Your Environment:
LINE 28: $HOST = 'XXX.XXX.XXX.XXX'; Insert ipaddress your server where your will be run ct.pl. (on this server LDAP)

LINE 33:
$ADMIN = "cn=admin,o=org";
Insert user name. Under this user script will be login to the LDAP(edir) and will search users and put telephone number from the sys:\a.csv
This user must have rights for this.
A simple way - use admin account

LINE 31:
$PASSWD = 'password';
password user admin.org

LINE 32:
$BASEDN ="o=org";
From this container and below script will be searched.

5. prepare and copy file a.csv to the sys:a.csv

How to run script:

From the server console run this string:
perl sys:\perl\scripts\ct.pl

What does it does:

  • Open for read file sys:\a.csv
  • Reads this file string by string
  • For every string, search:
    example, for string:
    "Putin Vladimir Vladimirovich";"0001"
    search in the edir from the o=org user object which has in the field "Full Name": "Putin Vladimir"
    If found - write new telephone number: 0001
    If not found -
    +write info about this error in to the log-file:
    sys:\results\chngtlph\chngtlph.log
    and
    +read other string

You can easily change the script as needed.
Do not forget LINE 95.
edir stores information in the UTF-8.
For records in Russian (prepared in Windows) it is important
*****************************************************
*  Thanks, Iain McLaren, for example use of PERL-script:
* http://forge.novell.com/modules/xfmod/project/?cpr-backup

*****************************************************

P.S.: I know of JRB-utilities.
It is a variant free-of-charge and it is more convenient for me that I can work directly on the console of a server, without a workstation.

AnhangGröße
ct.zip2.36 KB




User Comments

© 2013 Novell