The easiest way to do this is to run the script using crontab, but I would advise testing you script well first as you could make a script that causes problems.
$ crontab -e
and add the line:
Save and close, and then run
# update-rc.d cron defaults
Once you reboot the script will start automatically.
This appears to be a problem with relation to the Windows 8.1 Metro Apps and I resolved by doing the following (NB. critical to observe the sysprep log file (setuperr.log);
- Take Snapshot
- Run Sysprep: sysprep /generalize /oobe /shutdown
- When the error occurs, check the error log and then query the problem package using PowerShell (insert name of package into the “”). Get-AppxPackage -AllUsers | Where Name -Like “”
- Once you have it run the following to remove the package; Get-AppxPackage -AllUsers | Where Name -Like “” | Remove-AppxPackage
- Repeat steps 3 and 4 until successful.
If you don’t care whatsoever for Metro Apps (which is the case in our environment) you could just run the following and remove all packages; Get-AppxPackage | Remove-AppxPackage