I agree that putting a kill command in a script can be dangerous, so use caution with it.
We would typically have 400 to 500 users logged in, each with two processes running, as they attached to the application. After "wall"ing to users to log off, then "echo"ing a statement into /etc/nologin to prevent further logins from occurring, you can use a command line entry if the users have a process that is common. For example, if they all attach to an application called APP1, but you don't want to kill anything that is being run by root or perhaps an APP1 admin ID, you can do something like:
FIRST TIME AROUND DO THIS TO BE ABSOLUTELY SURE OF WHAT YOU ARE GOING TO KILL:
ps -ef|grep APP1|grep -vE "root|APP1adm"
Then check those processes listed to be sure of what the ps -ef sees.
When you are sure of what will be killed:
for x in `ps -ef|grep APP1|grep -vE "root|APP1adm"|awk '{print $2}'`
do
kill $x
done