You missed the third item in the list.

Errors with things like SHELL and RUN will be slient in many scenarios. The only way that you will be able to tell that there was an error is to check and display @ERROR and @SERROR.

Specifically there is a fairly well known problem where %COMSPEC% contains spaces or other characters which cause problems.

You are also ditching any error output from the command using "2>nul", so if there is a problem with the application you won't see the error either.

Get it working first, then silence it.

see how this works for you:
Code:
Break On
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('WrapAtEOL','On')

Dim $MB,$sSilence

; ** Uncomment the following line to silence the script once it is working **
; $sSilence=' >nul 2>nul'

$MB=MessageBox("Configuring Automatic Logoff...","Network Security",64,2)

If Not $sSilence "Removing old task..."+@CRLF EndIf
Shell '"'+%COMSPEC%+'" /C schtasks /delete /tn AutoLogoff /f '+$sSilence
; Note, ignoring errors for this command

If Not $sSilence "Creating new logoff task..."+@CRLF EndIf
Shell '"'+%COMSPEC%+'" /C schtasks /create /sc minute /mo 30 /ru System /tn AutoLogoff /tr \\utopia\netlogon\autologoff.bat '+$sSilence
If @ERROR
$MB=MessageBox("Could not create auto logoff task, Reason"+@CRLF+"["+@ERROR+"] "+@SERROR,"Task creation failure")
EndIf



The changes wrap the expanded %COMSPEC% value in quotes to avoid problems with spaces, and pop up a message if the add task command fails.

Once you have got the code working to your satisfaction, uncomment the $sSilence=... line to quiten thing down a bit.