I am posting this information in the forum in hopes that it will provide good information for others trying to do the same thing and to provide feedback to Novell Zenworks Engineers for development.
Problem #1
Out of the box, Shutdown actions in Zenworks cause problems with Dynamic Local User Policies.
Steps to Reproduce.
1) Create a Bundle with a Shutdown action, allow user to cancel, and set the shutdown duration to a nonzero number (i.e 300 seconds).
2) Assign a scheduled time for the bundle to execute.
3) Leave the computer logged off during the scheduled time.
4) Attempt to log in during the "cancellation window" period when the shutdown prompt would normally appear.
DLU will stop working and a second login box for local login will appear.
Problem #2
Screensavers and standby modes interfere with the shutdown action.
Steps to reproduce.
Same as above, but allow the computer to go to sleep or screensaver to appear prior to the shutdown schedule.
Typically the computer stay in its current state until the mouse is wiggled or a key is pressed, then it will shutdown.
Problem #3
Computers will intermittently hang during shutdown when a Shutdown Action runs with no user logged in.
I am observing this phenomenon occurring at 3-10% of computers in my environment.
Not sure the cause here, but the computer will never actually completely shuts down and requires manual intervention.
My workaround for all three problems.
1) Download "Wake up on Standby" wosb.exe from Downloads - WakeupOnStandBy
2) Create two bundles, one for users logged in and one for users not logged in to run at the same time.
For the User Logged in Bundle
Copy down and execute the wosb.exe (also can be run from a network share, change actions accordingly)
Install Actions (Set option to Install Always)
1) Create Folder %systemdrive%\myzenfolder (Run as System, continue on failure checked)
2) Install Files wosb.exe to %systemdrive%\myzenfolder (Run as System, copy if does not exist)
3) Launch Executable (Run as Dynamic Administrator and wait when action is complete)
Command %systemdrive%\myzenfolder\wosb.exe
Parameters /run /screenon tm=+0:01
Working Directory %systemdrive%\myzenfolder
Return Codes 0,2
4) Run Script (Define your own script, leave all other fields default, set to wait when action is complete, Run as Dynamic Administrator)
REM Is an interactive user logged in?
set ucount=1
for /f "tokens=*" %%G in ('wmic ComputerSystem Get UserName ^| Find /c "\"') do (set ucount==%%G)
REM In case something goes wrong with above throw nonzero return code
IF %ERRORLEVEL% NEQ 0 exit 1
REM If no user logged in throw nonzero return code
if %ucount% == 0 exit 1
Success Return Code is set to 0 on Advanced tab
5) Set your Reboot/Shutdown Action Last with the option for the user to cancel and your defined countdown value.
Set your bundle to "install" on your defined schedule
For the Not Logged In User Bundle
Copy down and execute the wosb.exe (also can be run from a network share, change actions accordingly)
Install Actions (Set option to Install Always)
1) Create Folder %systemdrive%\myzenfolder (Run as System, continue on failure checked)
2) Install Files wosb.exe to %systemdrive%\myzenfolder (Run as System, copy if does not exist)
3) Launch Executable (Run as Dynamic Administrator and wait when action is complete)
Command %systemdrive%\myzenfolder\wosb.exe
Parameters /run /screenon tm=+0:01
Working Directory %systemdrive%\myzenfolder
Return Codes 0,2
4) Run Script (Define your own script, leave all other fields default, set to wait when action is complete, Run as Dynamic Administrator)
REM Is anyone logged in?
set ucount=1
for /f "tokens=*" %%G in ('wmic ComputerSystem Get UserName ^| Find /c "\"') do (set ucount==%%G)
REM Check for an error
IF %ERRORLEVEL% NEQ 0 exit 1
REM Use native shutdown command instead of shutdown action (more reliable when no one is logged in for some reason)
if %ucount% == 0 shutdown /s /f /t 0
Success Return Code set to 0 on Advanced tab
Set your bundle to "install" on your defined schedule.
As you can see, this was an awful lot of work to get automatic shutdown working consistently without problems here! Hopefully someone else (or even Novell) comes up with a more elegant solution for all.
If all is well, any computers not logged in will shutdown immediately, and any computers logged in will prompt whether to shutdown.
Problem #1 goes away because the not logged in bundle shuts them down immediately
Problem #2 goes away because of the use of wosb.exe
Problem #3 goes away because a Shutdown Action is not running when no one is logged in
Problem #1
Out of the box, Shutdown actions in Zenworks cause problems with Dynamic Local User Policies.
Steps to Reproduce.
1) Create a Bundle with a Shutdown action, allow user to cancel, and set the shutdown duration to a nonzero number (i.e 300 seconds).
2) Assign a scheduled time for the bundle to execute.
3) Leave the computer logged off during the scheduled time.
4) Attempt to log in during the "cancellation window" period when the shutdown prompt would normally appear.
DLU will stop working and a second login box for local login will appear.
Problem #2
Screensavers and standby modes interfere with the shutdown action.
Steps to reproduce.
Same as above, but allow the computer to go to sleep or screensaver to appear prior to the shutdown schedule.
Typically the computer stay in its current state until the mouse is wiggled or a key is pressed, then it will shutdown.
Problem #3
Computers will intermittently hang during shutdown when a Shutdown Action runs with no user logged in.
I am observing this phenomenon occurring at 3-10% of computers in my environment.
Not sure the cause here, but the computer will never actually completely shuts down and requires manual intervention.
My workaround for all three problems.
1) Download "Wake up on Standby" wosb.exe from Downloads - WakeupOnStandBy
2) Create two bundles, one for users logged in and one for users not logged in to run at the same time.
For the User Logged in Bundle
Copy down and execute the wosb.exe (also can be run from a network share, change actions accordingly)
Install Actions (Set option to Install Always)
1) Create Folder %systemdrive%\myzenfolder (Run as System, continue on failure checked)
2) Install Files wosb.exe to %systemdrive%\myzenfolder (Run as System, copy if does not exist)
3) Launch Executable (Run as Dynamic Administrator and wait when action is complete)
Command %systemdrive%\myzenfolder\wosb.exe
Parameters /run /screenon tm=+0:01
Working Directory %systemdrive%\myzenfolder
Return Codes 0,2
4) Run Script (Define your own script, leave all other fields default, set to wait when action is complete, Run as Dynamic Administrator)
Quote:
REM Is an interactive user logged in?
set ucount=1
for /f "tokens=*" %%G in ('wmic ComputerSystem Get UserName ^| Find /c "\"') do (set ucount==%%G)
REM In case something goes wrong with above throw nonzero return code
IF %ERRORLEVEL% NEQ 0 exit 1
REM If no user logged in throw nonzero return code
if %ucount% == 0 exit 1
5) Set your Reboot/Shutdown Action Last with the option for the user to cancel and your defined countdown value.
Set your bundle to "install" on your defined schedule
For the Not Logged In User Bundle
Copy down and execute the wosb.exe (also can be run from a network share, change actions accordingly)
Install Actions (Set option to Install Always)
1) Create Folder %systemdrive%\myzenfolder (Run as System, continue on failure checked)
2) Install Files wosb.exe to %systemdrive%\myzenfolder (Run as System, copy if does not exist)
3) Launch Executable (Run as Dynamic Administrator and wait when action is complete)
Command %systemdrive%\myzenfolder\wosb.exe
Parameters /run /screenon tm=+0:01
Working Directory %systemdrive%\myzenfolder
Return Codes 0,2
4) Run Script (Define your own script, leave all other fields default, set to wait when action is complete, Run as Dynamic Administrator)
Quote:
REM Is anyone logged in?
set ucount=1
for /f "tokens=*" %%G in ('wmic ComputerSystem Get UserName ^| Find /c "\"') do (set ucount==%%G)
REM Check for an error
IF %ERRORLEVEL% NEQ 0 exit 1
REM Use native shutdown command instead of shutdown action (more reliable when no one is logged in for some reason)
if %ucount% == 0 shutdown /s /f /t 0
Set your bundle to "install" on your defined schedule.
As you can see, this was an awful lot of work to get automatic shutdown working consistently without problems here! Hopefully someone else (or even Novell) comes up with a more elegant solution for all.
If all is well, any computers not logged in will shutdown immediately, and any computers logged in will prompt whether to shutdown.
Problem #1 goes away because the not logged in bundle shuts them down immediately
Problem #2 goes away because of the use of wosb.exe
Problem #3 goes away because a Shutdown Action is not running when no one is logged in