IBM Support

How to deactivate N number of ClearQuest users using Rational ClearQuest APIs

Technote (FAQ)


How do you deactivate N number of ClearQuest users using IBM Rational ClearQuest APIs?


This is required to have a quick solution to deactivate N number of ClearQuest users without logging into IBM Rational ClearQuest User Administration Tool.


The Perl Script below uses the ClearQuest API and can be run on Windows.

Note: The ClearQuest Native Client must be installed on this machine.

User's login name can be written in a text file.
Each user's login name should be written in a separate line.

This script reads this file line by line and deactivates these users.


All source code and/or binaries attached to this document are referred to here as "the Program". IBM is not providing program services of any kind for the Program. IBM is providing the Program on an "AS IS" basis without warranty of any kind. IBM WILL NOT BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF IBM, OR ITS RESELLER, HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

  1. Navigate to the location where CQperl.exe is installed.
    By default: C:\Program Files\IBM\RationalSDLC\ClearQuest\CQperl.exe

  2. Save the below mentioned Perl script text to notepad and save with a .pl extension.

  3. Run the script using the following command:
    cqperl <>

    Pearl Script

    #!C:\Program Files\IBM\RationalSDLC\ClearQuest\CQperl.exe
    # Make sure you have correct path for CQperl.exe

    use CQPerlExt;

    # Create a Rational ClearQuest admin session
    $adminSession= CQAdminSession::Build();

    # Logon as admin
    # Provide correct values for admin password, Schema Repository name
    $adminSession->Logon( "admin", "<AdminPasswd>", "<SchemaRepository>" );

    # Provide the file path where you have saved user's login names (to be deactivated)
    $file = 'C:\temp\users.txt';
    open(INFO, $file);
    @users = <INFO>;

    print "@users\n";

    foreach my $user (@users)
    chomp $user;
    my $usertodeactivate = $user;
    $userList = $adminSession->GetUsers();
    $numUsers = $userList->Count();
    for ( $x=0; $x<$numUsers; $x++ )
    $userObj = $userList->Item( $x );
    $useractive = $userObj->GetActive();
    $loginname = $userObj->GetName();

    if ($useractive)
    if ( $usertodeactivate eq $loginname )
    print "The User $loginname is being deactivated now\n";

Document information

More support for: Rational ClearQuest

Software version:,,

Operating system(s): Windows

Reference #: 1655157

Modified date: 06 November 2013