SSH (enable it in sharing preferences. it is called remote login ) go to another machine and ssh into the imac (type ssh (your user name)@(ip of the iMac (can be gotten ping (hostname of the iMac) it should say on the first line PING (hostname) (ip address) ) and type top. look for loginwindow and get the pid of it (it should be to the left of the name) press control c to exit top and type kill (pid of loginwindow). There every user is logged out.
you would have to pull the power cable it will not let you shut it down
My way is easy if you know what you are doing!
You can even play music at the login window with SSH
My way is good for pranks too and works over the internet (not by default but if you want it to make sure you have a strong password on every account on the computer or set up a server that only has one user and has a really strong password then ssh to the other machine)
there's no way at all to do it? my cousin has this annoying habit of leaving the computer on and going out. we gotta either wait for him to come back to be able to shut it down, or do a hard reset on it.