I also use such a script.
I used the logon script to schedule a task that runs at 6 o'clock.
That task asks the user if the PC may be shut down. If the user didn't react in 60seconds I use the Shutdown() function in Kix.

The scheduled job is configured to use the local user account.

Problem now is that the job works if I start him manual, but if the user has left his desk and the PC is locked, I think the shutdown isn't executed.

Is there someone who has experience whit this?
Or someone who knows how I can show a messagebox via a scheduled job that runs as an administrator. Normally you don't see any output.