Added the ability to detect logged on users

A bug existed before that cause the script to stall if a user was
logged on. Added a case to test for that.