#355424
Anonymous
Participant

Sorry, was at home when I posted my reply. I’ve included the script below. Any feedback on why only works for some users would be greatly appreciated.

cheers,

Kent.
—————————————————————————————————–
#!bin/sh

#Get all users in our NetInfo Database
userList=`niutil -list / /users | cut -d” ” -f2`

#loop through each user
flag=
for userName in ${userList}
do

# Check to see if “mail” entry already exists
exists=`niutil -read / /users/$userName | grep “mail: $userName”`
result=`expr “$exists” : ‘.*’`

if (expr $result = 0)
then
# only create if doesn’t already exist
niutil -createprop / /users/$userName mail ${userName}@mmc.school.nz
echo “created $exists – $result”
fi
done

exit 0

Comments are closed