I've noticed, running this script on a Server 2019 it stops after the OneDrive Setup. For some reason, Onedrive.exe is not launched for me. Then the Stop-Process at line 816 will also fail and stop the script.
My very simple fix would be:
Stop-Process -Name "OneDrive" -Force -ErrorAction SilentlyContinue
Of course a get-process ... | stop-process would be nicer.
I've noticed, running this script on a Server 2019 it stops after the OneDrive Setup. For some reason, Onedrive.exe is not launched for me. Then the Stop-Process at line 816 will also fail and stop the script.
My very simple fix would be: Stop-Process -Name "OneDrive" -Force -ErrorAction SilentlyContinue
Of course a get-process ... | stop-process would be nicer.