
hi, Here is my first attempt. Please correct, criticize , comment , etc. I am still not very sure if I did that right. best regards -- Atif Ghaffar ---------------------------. +41 78 845 31 64 ¦ tel aghaffar@developer.ch ¦ email http://atifghaffar.com ¦ www 8206786 ¦ icq #!/usr/bin/perl -w # -- # otrs.addUser - Add User from CLI BEGIN{ use FindBin; unshift @INC, ($FindBin::Bin , "$FindBin::Bin/../"); use vars qw (%opts); use Getopt::Std; getopt('flp', \%opts); unless ($ARGV[0]){ print "$FindBin::Script [-f firstname] [-l lastname] [-p password] username"; print "\n"; exit; } } use lib '/opt/OpenTRS/'; use strict; use Kernel::Config; use Kernel::System::Syslog; use Kernel::System::DB; use Kernel::System::User; # -- # create common objects # -- my %CommonObject = (); $CommonObject{LogObject} = Kernel::System::Syslog->new(); $CommonObject{ConfigObject} = Kernel::Config->new(%CommonObject); $CommonObject{DBObject} = Kernel::System::DB->new(%CommonObject); $CommonObject{UserObject} = Kernel::System::User->new(%CommonObject); my %Param; undef %Param; #user id of the person adding the record? #root@loclhost? right? $Param{UserID}='1'; #Validrecord $Param{ValidID}='1'; $Param{Firstname}=$opts{'f'}; $Param{Lastname}=$opts{'l'}; $Param{Pw}=$opts{'p'}; $Param{Login}=$ARGV[0]; $CommonObject{UserObject}->UserAdd(%Param); # -- exit (0);