We've developed a logon script in PowerShell that runs in the background when user's logon. It works most of the time except one of the tasks it does is to copy a file if it's been updated, i.e. the time stamp on the source is different to the target.
The problem is that the source file is in OneDrive with the "on-demand" feature enabled, i.e. it's only downloaded when it's accessed. Now if OneDrive is up and running before the PowerShell Copy-Item command is run, there is no problem - the file is downloaded and copied fine.
However, if the logon script runs before OneDrive has launched, logged on and initialised, the copy fails. Worse, it sometimes deletes the target file and fails to copy.
So I need a programmatic way of pausing the logon script until OneDrive is fully working... simple request but not a simple answer I suspect :-(
PS. The list of tags around PowerShell and OneDrive is very limited...