I had a desire to shutdown workstations automatically, but only if no user was logged on. There isn't a current ZENworks Requirement that is "User logged on" there is one regarding primary user, but I wanted to avoid shutdown regardless of logged on user.
I created a bundle that copies/installs the following script onto the workstation, and then runs the script (and passes any reason text as desired). I had to copy/install the script to the workstation because there is still a flaw in the ZCM script translator that doesn't handle parts of the script properly if it was defined in the bundle action.
if %reason%.==. set reason=None
for /f "tokens=*" %%G in ('wmic ComputerSystem Get UserName ^| Find /c "\"') do (set ucount==%%G)
if %ucount% == 0 shutdown /s /t 5 /c %reason%
Should work for Windows XP and higher.
Disclaimer: As with everything else at Cool Solutions, this content is definitely not supported by Novell (so don't even think of calling Support if you try something and it blows up).
It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.