Automated processing of SysPrep. Likes to be on a [USB] flash drive; can run from other local storage. Log files will be stored where the program was executed from.
Can download just the commandlet: Download --right-click and "Save Link as..."
0️⃣0️⃣ Flush logged on user --usually the default user.
0️⃣1️⃣ Administrator, local configuration
0️⃣2️⃣ Users, cleanup local users
0️⃣3️⃣ Scheduled Task, cleanup
0️⃣4️⃣ Windows Update
0️⃣5️⃣ Disk Check, for dirty bit
0️⃣6️⃣ CleanMgr, run disk cleanup
0️⃣7️⃣ Bitlocker check
0️⃣8️⃣ Final reboot, in preparation for running SysPrep
0️⃣9️⃣ Windows APPX Packages
1️⃣0️⃣ SysPrep
Best practice is to use external storage such as a USB Flash drive.
- Manually run module_system_SysPrep with administrative privilege
- Pass the config file name as a parameter.
- default
module_system_SysPrep.properties
- First run will configure the local administrator and log out current user, which should be the unattend.xml first logon user.
- Log in with local Administrator account --no password
- CleanMgr will prompt if SAGE 100 is not set
- Final Reboot will reboot and auto-login Administrator
- Manually run module_system_SysPrep with admin privilege for the final SysPrep run.
- Delprof2
- Useful tool that does a complete job. Better than Powershell:
Get-CimInstance -Class Win32_UserProfile | Where-Object { $_.LocalPath.split('\')[-1] -eq 'UserA' } | Remove-CimInstance
- which leaves the user account on the system!
- Open shell/terminal with administrative privilege
- cd /D to module directory where module_system_SysPrep.cmd
- Pass config file name if not the default
module_system_SysPrep.properties
- Can have different properties files for different systems, then just pass the [custom] properties file as a parameter.
Example:
module_system_SysPrep.cmd
Custom.config
- Looks for APPX packages that are known to break SysPrep in Window 11
- Microsoft has deprecated the GUI for SysPrep since Windows 8.1
- SysPrep must be run with administrative privilege
- module_system_SysPrep logs will be saved here for archive:
- C:\Windows\System32\SysPrep\module_system_SysPrep<ISO_DATE>