Post-Setup commands are executed in two different phases:
- Machine or
(Before logon)
Commands are executed by SYSTEM, with full Admin rights (except for TrustedInstaller privileges).
During this phase, no user interaction (keyboard or mouse input) is allowed with any running process so commands must run unattended. Some apps or scripts may have explicit arguments to run in "silent" mode. Do not run anything that references HKCU, because the current user isn't actually you, but the SYSTEM user.
- User or
(After logon)
Commands are executed by the Primary User (you), with full Admin rights (except for TrustedInstaller).
Because it's running in your user desktop session, interaction is allowed. HKCU updates should be made here.
If your ERP application install is a bit more involved (or prolonged), then the best solution is to sysprep & generalize an image. Capture the generalized image, and save it to a new WIM file. Replace the ISO's install.wim with the captured version, so the ERP app is pre-installed in every system.
Add Post-Setup scripts to finalize whatever licensing, or localization steps are required in order to run.