How to stall the Windows Shell longer than 60 Seconds using Environment Manager 8.0

Version 1

    Verified Product Versions

    AppSense Environment Manager 8.0

    Introduction

    It may be required to stall the shell process at the start of a user session for longer than the default 60 seconds.
    An example reason would be if a logon script is required to complete before the shell loads, but is taking longer than 60 seconds to run.

    Detail

    The default maximum timeout setting for shell stalling in Environment Manager 8.0 is 60 seconds.
    Note: Environment Manager 8.1 onwards uses a different system by design.
    The Environment Manager Administration Guide demonstrates how to stall the shell above and beyond the default 60 seconds by using the following Engineering Key:
    Key: HKEY_LOCAL_MACHINE\Software\AppSense Technologies\Environment Manager
    Value Name: LogonActionWaitTimeout
    Value Type: DWORD
    Value Data: How long to stall the shell in Milliseconds (eg: 100000 for 100 seconds)
    However for Windows XP & 2003 an alternative workaround is required;
    1. Within the Environment Manager  Configuration, create a Set Registry Value action to set the following String Value at the END of the Logon Node process:
    Key: HKEY_CURRENT_USER\SOFTWARE\AppSenseShellStall
    Value Name: AppSenseReady
    Value Type: DWORD
    Value Data: 1
     
    2. Create a Custom Action under the Process Started trigger for the shell process (e.g explorer.exe), and insert the following VBS code:
    On Error Resume Next
    Dim objWshShell, strKey, strValue, timeoutSecs, maxStall
    Set objWshShell = CreateObject("WScript.Shell")
    maxStall = 60
    strKey = "HKEY_CURRENT_USER\SOFTWARE\AppSenseShellStall\AppSenseReady"
    Do While (strValue <> 1 and timeoutSecs < maxStall)
    strValue = objWshShell.RegRead(strKey)
    timeoutSecs = timeoutSecs + 1
    Wscript.sleep(1000)
    Loop
    How it works:
    The custom action will hold the shell process, while it waits for the registry value 'AppSenseReady' to be created at the end of the logon node, up to a maximum of the set 'maxStall' seconds. When the registry value is created the shell will be released within 1 second. 
    Note: Ensure that the AppSenseReady value is deleted or changed to 0 at logoff.