So my hope that the unattended visual studio updater script would be finished has not come true
So I added a pending reboot detection:
Additionally I wanted some more details in the event log regarding the version being updated and the version after the update. I added a few lines using the FileInfo class.
Beside that I stop the build agent service during the update process, so that builds do not fail while MSBuild is not available.
So here is the full script: