Skip to content

DavidGeeraerts/module_system_SysPrep

Repository files navigation

Logo generated using Midjourney Image Generator

🔃 module_system_SysPrep

📃 Description

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.

⬇️ Download

Can download just the commandlet: Download --right-click and "Save Link as..."

✅ Process List

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

📗 Instructions

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.

📙 Dependencies

  • 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!

📨 Passing Config file as Paramter

  • 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
📓 Notes (recent to old)