CA Service Management

  • 1.  Sync only added / updated users from AD to SDM 14.1.03

    Posted May 22, 2017 05:22 AM

    Want to sync only the newly created Active Directory users or updated users to CA Service desk. As the number of users are more, pdm_ldap_import taking long time to import the users data. This import needs to be done daily as new users are adding daily.

     

    Thanks in Advance.

     

    Regards

    Bindu



  • 2.  Re: Sync only added / updated users from AD to SDM 14.1.03
    Best Answer

    Posted May 22, 2017 06:44 PM

    Here is a Perl script I made to generate a batch file to execute the pdm_ldap_import with the appropriate parameters:

    #!/usr/local/bin/perl
    # -----
    # This script creates a batch file to be run at least 24 hours from now
    # to import/synchronize any contacts that have been created or updated since the last time the import was run.
    # This should be run after midnight local time.
    # To execute, use command pdm_perl buildImport.pl
    # -----
    # incorporate functions
    use strict;
    use warnings;
    use POSIX;
    use Time::Local;
    # get the constituent components of the local date/time
    my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
    # calculate the offset in hours between local time and GMT
    my $epocL = timelocal($sec, $min, $hour, $mday, $mon, $year);
    my $epocZ = timegm($sec, $min, $hour, $mday, $mon, $year);
    my $offset = ($epocL - $epocZ) / 3600;
    #if the offset is a negative number (timezones east of GMT) just use GMT
    if ($offset < 0) {$offset = 0}
    open(BATCH, ">ADimport.bat");
    # output first part of import command
    print BATCH "pdm_ldap_import -l \"(&(sAMAccountType=805306368)(whenChanged>=";
    # output variable part of commnd
    printf BATCH "%04d%02d%02d%02d", $year + 1900, $mon + 1, $mday, $offset;
    # complete the command
    print BATCH "0000.0Z))\"\n";
    close(BATCH);