Thank you all for your help on this. I have discovered the cause of this.
In group policy it was set to run on start up. The script had it adding this
value to the registry but we discontinued that and it had been commented out
as it was in the RunOnce key and it was running before the start up script had finished occasionally. Thank you all for your help.