Got in the mood to explain it in more details, if you haven't solved it already.
You can add the reg add command directly, which calls your post-reboot script from runonce.
This is how post-setup should look like ordered:
- reg add runonce batch (will be located in C:\Windows\Setup\Scripts\)
- shutdown -r -t 0
- mybatch.cmd (this is here just to copy the file to the above location, but do not execute it, way to ensure that is to have the reboot command above)
Regarding the reg add:
If you want to execute on user logon:
REG ADD "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /V "MyBatch" /t REG_SZ /F /D "C:\Windows\Setup\Scripts\mybatch.cmd"
Same for machine runonce, if you want to execute before users log on, HKLM
Your batch will be executed by the machine from the RunOnce reg key, and hopefully your batch file if it was correctly specified.
You can test that live from CMD before testing in a VM or for real on reinstall.
Don't forget to reboot the main set, because otherwise it will delete the files from Scripts folder, as a self-cleanup.
Let me know how it goes or if you have more questions.
Thanks.