Delayed Scheduled Task fails to run

This post has been republished via RSS; it originally appeared at: New blog articles in Microsoft Tech Community.

Hey there....
 
This is Phil here from the FSLogix Team.
 
I came across an issue recently which I thought I would share with you.
 
A customer reported that all the delayed scheduled tasks had stopped working . If they disabled FSLogix the Delayed Schedule Tasks would run after their configured delay.
 
Similarly if the user was logged onto 2 or more sessions then delayed scheduled tasks would only fail for the first session but would run for that user on the subsequent session.
 
After troubleshooting , we identified the cause was this value  being set: 
 
 [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\FSLogix\ODFC]

"RefreshUserPolicy"=dword:00000001

 

You can read more on what this setting does Here.
 

This setting impacts any Scheduled Task that has a delay set . They do not run.

 
 

2020-10-13_19h15_23.png

 

 

This Policy is needed when using ODFC containers and when you are applying Office Registry settings via GPO.

The ODFC disk is attached during a later stage of the login, which effectively is after GPO has run. If you have set any registry keys to be applied via GPO  to HKCU\Software\Microsoft\Office\{App name} where App Name can be any of the Office Application suite then they may not be applied.

Setting this RefreshUserPolicy triggers the GPO to re-apply GPs.
 

As this process happens AFTER  logon ,  the "new" task misses the logon event and hence the delayed scheduled task does not get triggered. 

 

In summary:

1. Login
2. FSLogix loads the profile
3. Task gets updated by something other than FSLogix (screenshot below)
4. Start shell fires: FSLogix loads ODFC
5. if RefreshUserpolicy = 1, we refresh the policies and update the task again (same screenshot below) and this causes it to trigger,  probably because now that its updated, it needs another logon event to trigger it, but at this point we are too late.

 

 

tak.png

 

There is no fix available as yet and the team are working on a fix for the next release.

 

In the meantime If you need to use the RefreshUserPolicy setting  to ensure that your Office Registry keys get applied and ALSO have delayed scheduled tasks,   you will need to remove the delay on the task and set that delay via a script.

 

If your delayed task executes an application or process then you will need to place that in a script wrapper and set the delay.

 

I tested creating  a non delayed task that itself does the wait (for example using powershell, sleep for 1 minute) instead of delaying it as part of a scheduled task and this works whilst allowing the use of the RefreshUserPolicy=1 setting.

 
sleep -Seconds 60
$wsh = New-Object -ComObject Wscript.Shell
$wsh.popup("Welcome ! from share with 1 min sleep")
 
results in the following 1 minute after logon:
PMcloughlin_2-1602610834934.png

 

Hope you find the above useful.

 

Until next time......

REMEMBER: these articles are REPUBLISHED. Your best bet to get a reply is to follow the link at the top of the post to the ORIGINAL post! BUT you're more than welcome to start discussions here:

This site uses Akismet to reduce spam. Learn how your comment data is processed.