I did some tests, and found that the ShutDown command returned a 0.

Return Code Value
0 = Computer shut down
System error code = Function failed

but the PC didn't shutdown.
* if I run the job manualy there is no problem.
* if I run the job automaticaly trough the scheduler when the workstation is locked the PC won't shutdown
* if I run the job automaticaly trough the scheduler when the workstation is NOT locked the PC WILL shutdown

So I think it is because the workstation is locked. Because this is the only difference.