%HOMESHARE% variable evaluated incorrectly in EM policy actions

Version 2

    Verified Product Versions

    AppSense Environment Manager 8.2AppSense Environment Manager 8.1AppSense Environment Manager 8.3

    Introduction

    When setting actions to use the %HOMESHARE% variable results are unexpected as the variable seems to expand as the root of the share.

    e.g. in AD the user has a homeshare set to be \\server\share\%username% but EM seems to evaluate it as \\server\share

    Detail

    This has been seen to be due to the 'Run Logon Scripts Synchronously' group policy being enabled.  By running logon scripts synchronously the environment variables are applied / refreshed by Winlogon much later in the logon process.  Environment Manager has completed it's logon actions by that point but has used the original root node for the homeshare.

    There are two suggested solutions:

    • Turn off the GPO setting to run scripts synchronously.
    • Delay the execution of dependent actions using a custom action.

    It is recommended to test the first option as this also speeds up the logon process but if that is not suitable for the customer's environment there is a vbscript that can be used as a custom action to delay the execution of the dependent actions that rely on the homeshare variable.  This script evaluates the length of an array built from the homeshare path in the volatile environment registry key:

    The path \\server\share is split on the '\' character into 4 strings in an array ("", "", "server", "share") which has an upper bound index of 3 (0, 1, 2, 3) - in cases where the homeshare path is set to subfolders of the initial share the script may need amending.  When Winlogon refreshes the environment block adding the username to the homeshare variable the length of the array will increase by 1 and the loop will end returning success.  There is also a timeout of 30 seconds to prevent the script from holding up logons indefinitely.  This can be amended to a lower timeout as required by editing the iSecs value.

     

    Attachment

    See Attachment : WaitForHomeShare.zip (below)