Sysprep (System Preparation Tool) เป็นเครื่องมือสำคัญสำหรับ Windows OS ช่วย automate deployment แต่บางครั้งเจอ error Sysprep was not able to validate your Windows installation โดยเฉพาะตอนรันคำสั่ง:
sysprep /generalize /oobe /shutdown
บทความนี้เสนอวิธีแก้ไข

Sysprep was not able to validate your Windows installation
สาเหตุหลายอย่าง: การติดตั้ง Windows Store App, หายไปของ default Windows Program, upgrade จาก Windows เวอร์ชันเก่า ฯลฯ
วิธีแก้ไข:
- Check the log file
- Turn BitLocker off and try
- Remove UWP apps you may have installed
- Reinstall default Windows UWP apps
- Modify Registry
- Sysprep will not run on an upgraded OS
1] Check the log file
ตรวจสอบ log file ที่ %windir%\system32\Sysprep\panther\setupact.log
เปิด "setupact.log" ด้วย Notepad หา error อาจชี้ทาง troubleshoot
2] Turn BitLocker off and try
ถ้าหลังเช็ค log พบ error ทั้งสองข้อนี้ ลองปิด BitLocker:
Error SYSPRP BitLocker-Sysprep: BitLocker is on for the OS volume. Turn BitLocker off to run Sysprep. (0x80310039)
Error [0x0f0082] SYSPRP ActionPlatform::LaunchModule: Failure occurred while executing 'ValidateBitLockerState' from C:\Windows\System32\BdeSysprep.dll
ปิด BitLocker: เปิด Command Prompt Admin จาก Start Menu พิมพ์คำสั่ง Enter:
manage-bde -status
Disable-Bitlocker –MountPoint 'C:'
Bitlocker จะปิด ลองรัน Sysprep ใหม่
3] Remove UWP apps you may have installed
ถ้าเจอ error เหล่านี้ แปลว่าติดตั้ง Universal Windows Platform apps หรือลบ application ผิด ต้องทำ solution 3 และ 4:
Error SYSPRP Package SomeAppName_1.2.3.500_x64__8we4y23f8b4ws was installed for a user, but not provisioned for all users. This package will not function properly in the sysprep image.
Error SYSPRP Failed to remove apps for the current user: 0x80073cf2.

ลบ UWP apps ทั้งหมดเพื่อแก้ไข มีหลายวิธี bulk uninstall apps
พิมพ์ชื่อแอปในช่องค้นหา คลิก Uninstall ตามคำแนะนำ
อ่านเพิ่ม: Sysprep fails on removing or updating Provisioned Windows Store apps
4] Reinstall default Windows UWP apps

ถ้า default Windows app หายไป อาจเจอ error นี้ ต้อง restore default Windows programs ทั้งหมด
เปิด Windows PowerShell Admin จาก Start Menu พิมพ์คำสั่ง Enter:
Get-AppxPackage -AllUsers| Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
รอสักครู่ รีสตาร์ท ตรวจสอบปัญหา
5] Modify Registry

ถ้าเจอ Sysprep error หลัง upgrade Windows 10 Modify Registry นิดหน่อยอาจแก้ได้
เปิด Registry Editor จาก Start Menu ไปที่:
Computer\HKEY_LOCAL_MACHINE\SYSTEM\Setup
คลิกขวา Upgrade key > Delete
รีสตาร์ท ตรวจสอบ
6] Sysprep will not run on an upgraded OS
ถ้า upgrade OS จาก Windows 7, 8, 8.1 เป็น Windows 10 จะเจอ error:
Error [0x0f0036] SYSPRP spopk.dll:: Sysprep will not run on an upgraded OS. You can only run Sysprep on a custom (clean) install version of Windows.
รัน Sysprep ได้เฉพาะ custom (clean) install เท่านั้น
繞道: เปลี่ยนค่า CleanupState key เป็น 7 เปิด Registry Editor ไปที่:
HKEY_LOCAL_MACHINE\SYSTEM\Setup\Status\SysprepStatus
คลิกสองครั้ง CleanupState เปลี่ยนค่าเป็น 7
รีสตาร์ท ตรวจสอบ
เกี่ยวข้อง: A fatal error occurred while trying to sysprep the machine
