You could also use finger to get a list of users. This is a (non-AIX, but it should work) script I use to kill off Oracle users and their processes after two hours inactivity, if more than 40 users are logged in. I run it every hour 8:00 am - 5:00 pm:
USERS=`finger | wc -l`
if [ $USERS -gt 40 ]
then
rm users 2>/dev/null
finger -i > times
grep hours times > times1
cat times1 | tr -s ' ' ' ' | cut -f1 -d' ' > times2
for i in `cat times2`
do
ps -ef |grep $i | grep -v root| tr -s ' ' ' ' | cut -f4 -d' ' >> users
done
cat users | while read number
do
kill $number 2>/dev/null
done
else
exit
fi
None too elegant, but effective nonetheless. Hope this helps or gives some idea how to proceed in your circumstance.