ผมเผชิญกับรหัสข้อผิดพลาด 0x80073712 เมื่อพยายามติดตั้งอัปเดตความปลอดภัยบน Windows Server 2016 ตามที่พบภายหลัง ข้อผิดพลาดนี้เกี่ยวข้องกับ Windows component store ที่เสียหาย ในบทความนี้ เราจะดูวิธีซ่อมแซม component store ใน Windows 10 หรือ Windows Server 2016/2012 R2 และกู้คืนการทำงานที่ถูกต้องของบริการ Windows Update
เมื่อพยายามติดตั้งอัปเดตใน Windows Update ข้อผิดพลาดปรากฏ:
Some update files are missing or have problems. We’ll try to download the update. Error code: (0x80073712)

ก่อนอื่น ผมลองรีเซ็ตการตั้งค่า Windows Update agent และล้างไดเรกทอรี SoftwareDistribution ตามที่แนะนำในบทความ "How to reset the Windows Update Settings?" แต่ไม่ช่วย
จากนั้นใช้คำสั่ง dism /online /get-packages ตรวจสอบว่าอัปเดตระบบทั้งหมดอยู่ในสถานะ Installed

หากอัปเดตใดๆ มีสถานะ Install Pending คุณสามารถลบได้อย่างถูกต้องโดยใช้คำสั่ง DISM นี้ (ใช้สตริง Package Identity ของคุณ):
DISM.exe /Online /Remove-Package /PackageName:Package_for_KB4520724~31bf3856ad364e35~amd64~~14393.3320.1.1 /quiet /norestart
ใช้เวลานานค่อนข้างมากในการหาวิธีแก้ไขข้อผิดพลาด Windows Update นี้ แต่ระหว่างการ troubleshooting ผมต้องติดตั้ง .Net Framework 3.5 บน Windows Server 2016 ระหว่างการติดตั้งส่วนประกอบ .Net ด้วยคำสั่ง DISM ข้อผิดพลาดทั่วไปปรากฏขึ้นซึ่งให้คำแนะนำสำคัญสำหรับการดำเนินการต่อไป:
The request to add or remove features on the specified server failed. Installation of one or more roles, role services or features failed. The component store has been corrupted. Error: 0x80073712.

ในเวลาเดียวกัน คุณสามารถพบข้อผิดพลาดต่อไปนี้ใน CBS.log (%WinDir%\Logs\CBS\CBS.log):
[HRESULT = 0x80073712 - ERROR_SXS_COMPONENT_STORE_CORRUPT]
如你所見 component store บนคอมพิวเตอร์ของคุณเสียหายไปด้วยเหตุผลบางอย่าง ดังนั้น Windows Update จึงไม่สามารถรับข้อมูลจาก CBS (Component-Based Servicing) manifest ที่จำเป็นสำหรับการติดตั้งอัปเดต คุณสามารถกู้คืน component store โดยใช้คุณสมบัติ DISM สำเร็จรูป
ในกรณีที่ง่ายที่สุด คุณจะไม่ต้องการ Windows install image (ดิสก์) เพื่อกู้คืน component store ระบบจะใช้ไฟล์ component store บนดิสก์ท้องถิ่นและเว็บไซต์ Windows Update สำหรับการกู้คืน (local WSUS server ไม่สามารถใช้สำหรับกู้คืน component store ได้)
ขั้นแรก ตรวจสอบสถานะ component store ของคุณด้วยคำสั่ง:
dism /online /cleanup-image /checkhealth
หากคุณเห็นข้อความ "component store is repairable" หลังการวิเคราะห์ คุณสามารถพยายามกู้คืน component store ของคุณด้วยคำสั่งต่อไปนี้:
dism /online /cleanup-image /restorehealth
ในบางกรณี การทำเช่นนี้เพียงพอแล้ว แต่ในสถานการณ์ของผม DISM ส่งคืนข้อผิดพลาดนี้:
Error: 0x800f0906 The source files could not be downloaded.
ในกรณีนี้ เพื่อกู้คืน Windows คุณต้องการดิสก์ติดตั้งพร้อมการกระจาย Windows ของคุณ สมมติว่าคุณ mount Windows Server installation ISO file ของคุณ แล้วตรวจสอบรายการ Windows editions ปัจจุบันในไฟล์ install.wim บน image ที่ mount (ดิสก์):
dism /Get-WimInfo /WimFile:e:\sources\install.wim

ผมติดตั้ง Windows Server 2016 Standard (Desktop Experience) ดังนั้นผมจะใช้ index (2) ในคำสั่งต่อไปนี้:
dism /online /cleanup-image /restorehealth /source:e:\sources\install.wim:2 /LimitAccess
ตรวจสอบสถานะ component store อีกครั้ง:
Dism /Online /Cleanup-Image /CheckHealth
DISM ควรคืนค่า: No component store corruption detected

หลังจาก component store ถูกกู้คืนแล้ว ให้รีสตาร์ท Windows และตรวจสอบว่า Windows updates