From my experience, GPO scripts will not run sync, meaning that the desktop will appear before the script completes.

LegalNoticeCaption should IMHO, be applied as a GPO and not as part of the script which would then negate the need for the script to run sync.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.