Results 1 to 9 of 9

Thread: Query for non-used accounts

  1. #1
    Join Date
    Mar 2007
    Posts
    73
    Rep Power
    8

    Default Query for non-used accounts

    Hi gang! Does anyone know of a query that I could run, that would poll for unused email accounts? We currently give accounts to all users, but I know that many don't use them. A query that would list open account, that have not been logged into in over a month would be great. Does anyone know how this could be done?

    Thanks!

  2. #2
    Join Date
    Jul 2007
    Location
    Baltimore
    Posts
    1,649
    Rep Power
    11

    Default

    this is easier than that. log into the admin web interface. on the bottom of th left hand side you'll see a "Searches" area that should have "Inactive accounts (30 days)"

  3. #3
    Join Date
    Aug 2009
    Posts
    4
    Rep Power
    6

    Default

    Is there any way to export this report out to any other format? I did it last year, but can't remember how. All I remember was that it was insanely time-consuming and I guessed that I was reinventing the wheel.

  4. #4
    Join Date
    Jan 2007
    Location
    Minnesota
    Posts
    719
    Rep Power
    9

    Default

    Utility script that I call "rootsearch":
    Code:
    #!/bin/sh
    /opt/zimbra/openldap/bin/ldapsearch -LLL -x -D"`/opt/zimbra/bin/zmlocalconfig -s zimbra_ldap_userdn|awk '{print $3}'`" -w"`/opt/zimbra/bin/zmlocalconfig -s zimbra_ldap_password|awk '{print $3}'`" -H `/opt/zimbra/bin/zmlocalconfig ldap_url|awk '{print $3}'` $*
    And then you can list usernames and other potentially useful information with
    Code:
    rootsearch '(zimbraLastLogonTimestamp<=20090528141404Z)' uid zimbraprefmailforwardingaddress zimbraaccountstatus uid
    You can only do <= searches on timestamps. To do a > search, you need negation: (!(zimbraLastLogonTimestamp<=20090528141404Z))

  5. #5
    Join Date
    Aug 2009
    Posts
    4
    Rep Power
    6

    Default

    thanks for the quick repsonse. unfortunately, i'm not a big unix buy. i was able to run the first command in putty, but i'm thinking i have to use your code to create the rootsearch utility???
    this looks like exactly what I need, but i inherited this system and i'm still not up to speed on the unix side of things. (windows fan-boy here)
    any other information you could provide would be extremely helpful and more than appreciated.

  6. #6
    Join Date
    May 2008
    Location
    Taiwan
    Posts
    296
    Rep Power
    7

    Default

    i write a script several days ago for similiar purpose and i hope this could help your case.

    Run script like this :
    ( to get users never login and login 30 days ago into /tmp/user.list file)
    ./myscript.sh 30



    Code:
    #!/bin/bash
    
    if [ $# -ne 1 ]; then
       echo "Usage: $0 day"
       echo "Example: $0 30"
       exit 2
    fi
    
    domain="@example.com"
    ACCT=/tmp/acct.txt
    OUTPUT=/tmp/user.list
    
    rm -rf $ACCT $OUTPUT
    
    zmaccts | grep $domain | sed /wiki/d | sed /admin/d | sed /spam./d | sed /ham./d
     > $ACCT
    
    today=`date '+%s'`
    userinput=`echo "$1*24*60*60" | bc`
    
    cat $ACCT |
    while read line; do
       name=`echo $line | awk '{print $1}'`
       if [ `echo $line | awk '{print $5}'` = "never" ]; then 
          echo "$name never" >> $OUTPUT
              continue
       else
          lastlogin=`echo $line | awk '{print $5}' | awk -F/ '{print 2000+$3 $1 $2}'
    `
       fi
    
      last=`date -d $lastlogin '+%s'`
      if [ `echo "$today - $last" | bc` -ge $userinput ]; then
         echo "$name $lastlogin" >> $OUTPUT
      fi
    
    done

  7. #7
    Join Date
    Aug 2009
    Posts
    4
    Rep Power
    6

    Default

    Thanks. I'll try that out.

  8. #8
    Join Date
    Aug 2009
    Location
    Minnesota
    Posts
    16
    Rep Power
    6

    Default

    Thanks!

    Do you have to run it as the zimbra user?

    And I am assuming that the 30 is for the number of days back the person has logged in. So for querying only the people that have never logged in you would pass a 0?
    Last edited by msonen; 09-28-2009 at 07:28 PM.

  9. #9
    Join Date
    Aug 2009
    Location
    Minnesota
    Posts
    16
    Rep Power
    6

    Default

    Nevermind. Thanks I got it working.

Similar Threads

  1. Multiple Mail Accounts, Folders
    By skwdenyer in forum Users
    Replies: 12
    Last Post: 12-01-2013, 08:52 PM
  2. Query for Message
    By tsx in forum Developers
    Replies: 0
    Last Post: 09-03-2008, 08:23 AM
  3. Inaccurate number accounts used
    By zbowden in forum Administrators
    Replies: 1
    Last Post: 12-10-2007, 06:47 AM
  4. Set Zimbra to Automatically Download from POP3 Accounts
    By dbachman in forum Administrators
    Replies: 1
    Last Post: 08-29-2007, 10:05 AM
  5. Lotus migration
    By babou in forum Migration
    Replies: 15
    Last Post: 03-05-2007, 10:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •