Is there a way to detect if there is a user logged on to a workstation (primarily xp and 7) and use that as a requirement for a bundle? and also use the opposite as well for another bundle (no user logged on)

I already have a method for telling users to reboot their machines if they haven't done so in several days, but I get errors on that bundle if there is not a user logged in (Failed to process launch in user space)
I would like to automatically shutdown any machines that do not have a user logged in.