Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> ระบบ >> Windows 10

ใช้ SetupDiag.exe วินิจฉัย Windows 10 Upgrade Errors

ตาม Windows 10 Lifecycle ผู้ใช้ต้องติดตั้ง Large Update Packages (Feature Updates) บ่อยกว่า Windows เวอร์ชันก่อนหน้า Windows 10 อัปเกรดปีละ 2 ครั้ง ปัจจุบัน Latest คือ Windows 10 1809 (October 2018 Update) Windows 10 Version Upgrade เปรียบเทียบได้กับการติดตั้ง Service Pack ใน Windows เวอร์ชันก่อนหน้า สมาชิก Windows 10 Insider Preview Program ติดตั้ง Build บ่อยกว่า — System Build อัปเดต 3-4 ครั้งต่อเดือน

Windows 10 Upgrade ไม่ได้สำเร็จทุกครั้ง ด้วยเหตุผลต่างๆ การติดตั้ง Build ใหม่อาจล้มเหลว แต่ไม่ phảiทุกครั้งที่เข้าใจได้ว่าทำไม Update ติดตั้งไม่ได้ (Windows ไม่แสดงข้อมูลที่มีความหมาย) อย่างไรก็ตาม ข้อมูลทั้งหมดเกี่ยวกับกระบวนการ Upgrade Build จะถูกเก็บใน Log Files ข้อมูลนี้มีประโยชน์สำหรับการวินิจฉัยและแก้ไข Windows 10 Upgrade Errors Logs เหล่านี้เป็น Plain Text Files และเพื่อหาข้อมูลที่มีความหมาย ต้องเป็น Windows Expert จริงๆ

Microsoft's SetupDiag.exe Tool

โชคดีที่ Microsoft เปิดตัว Diagnostic Tool ใหม่ SetupDiag.exe ช่วยให้ได้ Detailed Information เกี่ยวกับเหตุผลที่ Windows 10 Build ไม่ได้ Upgrade บนคอมพิวเตอร์ของคุณ เป็น Command Line Tool ต้องรันบน Windows 10 Computer ที่ Upgrade ไม่สำเร็จโดยตรง หรือ Offline Mode บนคอมพิวเตอร์อื่น ซึ่งต้อง Copy Log Files จากคอมพิวเตอร์ที่มีปัญหาไว้ก่อน

SetupDiag สแกน Windows Install Logs และหา Specific Errors ที่บ่งชี้ถึง Windows Upgrade Issue เฉพาะ

SetupDiag.exe ทำงานใน Windows 10 ต้องการ .NET Framework 4.6 หรือสูงกว่าติดตั้งอยู่ (ตรวจสอบ .NET Framework Version) สามารถใช้ Tool ได้ทั้ง Diagnose Upgrade Errors ของ Windows 10 Builds และตอน Upgrade จาก Windows 7 SP1 หรือ Windows 8.1 เป็น Windows 10 (ต้อง Copy Upgrade Log Files ไปคอมพิวเตอร์ที่รัน Windows 10 เพื่อ Analyze)

ดาวน์โหลด SetupDiag Tool จาก Link นี้ https://go.microsoft.com/fwlink/?linkid=870142 และรันใน Elevated CMD ตอนรันโดยไม่มี Parameters Tool จะพยายามหา Log Files ที่ Windows 10 สร้างระหว่าง Upgrade

SetupDiag Search ตาม Standard Paths ที่ System สร้างในขั้นตอนต่างๆ ของ Windows 10 Build Installation ใหม่ โดย Default Log Files อยู่ในโฟลเดอร์ต่อไปนี้:

  • \$Windows.~bt\Sources\Rollback — Upgrade Files ปรากฏใน Directory นี้ถ้า Windows 10 Upgrade จบด้วย Error และต้อง Rollback กลับ Build ก่อนหน้า
  • \$Windows.~bt\sources\panther
  • \Windows\Panther
  • \Windows\Panther\NewOS

หลัง Analyze Logs เสร็จ Tool สร้าง results.log file ใน Directory ที่รัน Tool ไฟล์นี้มีรายการ Errors ที่เกิดระหว่าง Upgrade (ระบุ Location ของ Result File ได้ด้วย Parameter /Output) Utility ยังสร้าง ZIP-archive พร้อม Source Log Files

สามารถรัน SetupDiag ใน Offline Mode สแกน Log Files ที่ Copy จากคอมพิวเตอร์อื่นได้ ตัวอย่าง สแกน Log Files Offline ในโฟลเดอร์เฉพาะและบันทึก Result ไปไฟล์ที่ระบุ:

SetupDiag.exe /Output:C:\SetupDiag\Results.log /Mode:Offline /LogsPath:D:\Logs

SetupDiag อาจใช้ Analyze Memory Dump Files (Minidump) ที่สร้างใน Windows 10 ตอน BSOD ปรากฏ (ต้องติดตั้ง WinDbg) setupmem.dmp สร้างใน %SystemDrive%$Windows.~bt\Sources\Rollback หรือ %WinDir%\Panther\NewOS\Rollback ขึ้นอยู่กับ Stage ที่ Windows 10 Build Upgrade ถูก Interrupt

เพื่อ Analyze setupmem.dmp ใน Directory ที่ระบุ รัน:

SetupDiag.exe /Output:C:\SetupDiag\Dumpdebug.log /Mode:Offline /LogsPath:D:\Dump

SetupDiag Rules

ตอนเริ่ม SetupDiag จะเห็น Messages ใน Console:

SetupDiag: processing rule: CompatScanOnly. No match.
SetupDiag: processing rule: BitLockerHardblock. No match.
SetupDiag: processing rule: VHDHardblock. No match.
SetupDiag: processing rule: PortableWorkspaceHardblock. No match.
SetupDiag: processing rule: AuditModeHardblock. No match.
SetupDiag: processing rule: SafeModeHardblock. No match.

SetupDiag ใช้ Predefined Patterns (Rules) จำนวนมากเพื่อหา Known Windows 10 Upgrade Issues หมายถึง SetupDiag จะช่วยหาเฉพาะ Upgrade Errors ที่กำหนดใน Patterns เหล่านี้ No match หมายถึงไม่พบปัญหาที่ระบุใน Logs

ชุด SetupDiag Rules ขยายตัวเรื่อยไป เช่น SetupDiag v1.00 (03/30/2018) มี 26 Rules SetupDiag v1.4.0.0 (12/18/2018) มี 53 Templates แต่ละ Rule มีชื่อและ Unique Identifier มาดู SetupDiag Rules และ Upgrade Errors ที่เกี่ยวข้องสรุปสั้นๆ

  1. CompatScanOnly — FFDAFD37-DB75-498A-A893-472D49A1311D — setup.exe เรียกใน Compatibility Mode ไม่ใช่ Upgrade Mode
  2. BitLockerHardblock — C30152E2-938E-44B8-915B-D1181BA635AE — Source System มี BitLocker เปิดอยู่ไม่รองรับใน Target
  3. VHDHardblock — D9ED1B82-4ED8-4DFD-8EC0-BE69048978CC — System บูทเป็น VHD Image (Upgrade Mode นี้ไม่รองรับใน Windows 10)
  4. PortableWorkspaceHardblock — 5B0D3AB4-212A-4CE4-BDB9-37CA404BB280 — System บูทจาก USB Windows To-Go (Upgrade ใน Windows To-Go Environment ไม่รองรับ)
  5. AuditModeHardblock — A03BD71B-487B-4ACA-83A0-735B0F3F1A90 — OS บูทเข้า Audit Mode
  6. SafeModeHardblock — 404D9523-B7A8-4203-90AF-5FBB05B6579B — OS บูทเข้า Safe Mode
  7. InsufficientSystemPartitionDiskSpaceHardblock — 3789FBF8-E177-437D-B1E3-D38B4C4269D1 — System Partition ไม่มีพื้นที่พอสำหรับ Upgrade
  8. CompatBlockedApplicationAutoUninstall – BEBA5BC6-6150-413E-8ACE-5E1EC8D34DD5 — พบ Incompatible App ต้องลบก่อน Upgrade Build
  9. CompatBlockedApplicationDismissable — EA52620B-E6A0-4BBC-882E-0686605736D9 — ตอนติดตั้ง Quiet Mode (/quiet) เกิด Error ต้องโต้ตอบ User บล็อกการติดตั้ง
  10. CompatBlockedApplicationManualUninstall — 9E912E5F-25A5-4FC0-BEC1-CA0EA5432FF4 — พบ Non-standard App ไม่มี Entry ใน Add/Remove Programs ต้องลบไฟล์ด้วยตนเอง
  11. HardblockDeviceOrDriver — ED3AEFA1-F3E2-4F33-8A21-184ADF215B1B — Driver ติดตั้งบ้างตัวไม่ Compatible กับ OS ใหม่ ต้องลบ
  12. HardblockMismatchedLanguage — 60BA8449-CF23-4D92-A108-D6FCEFB95B45 — Language ของ Source และ Target System ไม่ตรงกัน
  13. HardblockFlightSigning — 598F2802-3E7F-4697-BD18-7A6371C8B2F8 — พยายามติดตั้ง Pre-release (Windows Insider) บนคอมพิวเตอร์ที่ Secure Boot เปิดอยู่ Pre-release จะไม่บูทในโหมดนี้
  14. DiskSpaceBlockInDownLevel — 6080AFAC-892E-4903-94EA-7A17E69E549E — System หมด Disk Space ตอน Upgrade
  15. DiskSpaceFailure — 981DCBA5-B8D0-4BA7-A8AB-4030F7A10191 — System หมด Disk Space หลัง Reboot เข้า Release ใหม่
  16. DeviceInstallHang — 37BB1C3A-4D79-40E8-A556-FDA126D40BC6 — System ค้างหรือ Fail (BSOD) ระหว่าง Upgrade Installation
  17. DebugSetupMemoryDump — C7C63D8A-C5F6-4255-8031-74597773C3C6 — BSOD ปรากฏระหว่างติดตั้ง ต้อง Analyze Memory Dump
  18. DebugSetupCrash — CEEBA202-6F04-4BC3-84B8-7B99AED924B1 — Setup Error ต้อง Debug Memory Dump
  19. DebugMemoryDump — 505ED489-329A-43F5-B467-FCAAF6A1264C — Rule สำหรับ Debug Memory.dmp ที่สร้างระหว่าง Setup/Upgrade
  20. BootFailureDetected — 4FB446C2-D4EC-40B4-97E2-67EB19D1CFB7 — Boot Failure เกิดขึ้นที่ Stage เฉพาะของ Upgrade
  21. FindDebugInfoFromRollbackLog — 9600EB68-1120-4A87-9FE9-3A4A70ACFC37 — ให้ข้อมูล BSOD ไม่ต้องติดตั้ง Debug Package
  22. AdvancedInstallerFailed — 77D36C96-32BE-42A2-BB9C-AAFFE64FCADC — Fatal Installer Error
  23. FindMigApplyUnitFailure — A4232E11-4043-4A37-9BF4-5901C46FD781 — Error ใน Migration Unit
  24. FindMigGatherUnitFailure — D04C064B-CD77-4E64-96D6-D26F30B4EE29 — Detailed Info เกี่ยวกับ Failed Migration Unit
  25. CriticalSafeOSDUFailure — 73566DF2-CA26-4073-B34C-C9BC70DBF043 — ล้มเหลวในการ Update SafeOS Image
  26. UserProfileCreationFailureDuringOnlineApply — 678117CE-F6A9-40C5-BC9F-A22575C78B14 — Error ตอนสร้าง/แก้ไข User Profile ระหว่าง Online Phase ของ Upgrade
  27. WimMountFailure — BE6DF2F1-19A6-48C6-AEF8-D3B0CE3D4549 — Mount WIM File ไม่ได้ระหว่าง Upgrade
  28. FindSuccessfulUpgrade — 8A0824C8-A56D-4C55-95A0-22751AB62F3E — Windows 10 Build Upgrade สำเร็จ
  29. FindSetupHostReportedFailure — 6253C04F-2E4E-4F7A-B88E-95A69702F7EC — Failure Early Stages ของ Upgrade ใน Setuphost.exe
  30. FindDownlevelFailure — 716334B7-F46A-4BAA-94F2-3E31BC9EFA55 — Error ใน SetupPlatform
  31. FindAbruptDownlevelFailure — 55882B1A-DA3E-408A-9076-23B22A0472BD — Info เกี่ยวกับ Latest Failure เมื่อ Log Entries จบอย่างกะทันหัน
  32. FindSetupPlatformFailedOperationInfo — 307A0133-F06B-4B75-AEA8-116C3B53C2D1 — Info เกี่ยวกับ Phase และ Error หาก SetupPlatform Critical Failure เกิดขึ้น
  33. FindRollbackFailure — 3A43C9B5-05B3-4F7C-A955-88F991BB5A48 — Latest Action และ Problem Phase ก่อน Rollback กลับ Windows 10 Version ก่อนหน้า
  34. AdvancedInstallerGenericFailure – 4019550D-4CAA-45B0-A222-349C48E86F71 – Read/Write Errors ของ AdvancedInstaller
  35. OptionalComponentFailedToGetOCsFromPackage – D012E2A2-99D8-4A8C-BBB2-088B92083D78 – Info เกี่ยวกับ Error ใน Optional Component ตอนพยายาม Get List ของ Package Components
  36. OptionalComponentOpenPackageFailed – 22952520-EC89-4FBD-94E0-B67DF88347F6 – Failure ตอนพยายาม Open Optional Component
  37. OptionalComponentInitCBSSessionFailed – 63340812-9252-45F3-A0F2-B2A4CA5E9317 – Installer หรือ Component เฉพาะไม่ได้รัน
  38. UserProfileCreationFailureDuringFinalize – C6677BA6-2E53-4A88-B528-336D15ED1A64 — Error สร้าง User Profile Final Stage ของ Upgrade
  39. WimApplyExtractFailure – 746879E9-C9C5-488C-8D4B-0C811FF3A9A8 — Failure ของ WIM Image ตอน Unpack
  40. UpdateAgentExpanderFailure – 66E496B3-7D19-47FA-B19B-4040B9FD17E2 — DPX Failure ตอน Update ผ่าน Windows Update
  41. FindFatalPluginFailure – E48E3F1C-26F6-4AFB-859B-BF637DA49636 — Error ใน Plugin หนึ่ง
  42. AdvancedInstallerFailed – 77D36C96-32BE-42A2-BB9C-AAFFE64FCADC – Critical Failure ใน AdvancedInstaller ระหว่างรัน Installer Package
  43. MigrationAbortedDueToPluginFailure – D07A24F6-5B25-474E-B516-A730085940C9 – Critical Failure ใน Migration Plugin ทำให้ Setup Abort Migration
  44. DISMAddPackageFailed – 6196FF5B-E69E-4117-9EC6-9C1EAB20A3B9 – Critical Failure ระหว่าง DISM Add Package Operation
  45. PlugInComplianceBlock – D912150B-1302-4860-91B5-527907D08960 – Detects Compat Blocks จาก Server Compliance Plug-ins
  46. AdvancedInstallerGenericFailure – 4019550D-4CAA-45B0-A222-349C48E86F71 – Triggers บน Advanced Installer Failures แบบ Generic
  47. FindMigGatherApplyFailure – A9964E6C-A2A8-45FF-B6B5-25E0BD71428E – Shows Errors เมื่อ Migration Engine Fails Out บน Gather หรือ Apply Operation
  48. OptionalComponentFailedToGetOCsFromPackage – D012E2A2-99D8-4A8C-BBB2-088B92083D78 – Optional Component Migration Operation Failed ถึง Enumerate Optional Components จาก Optional Component Package
  49. OptionalComponentOpenPackageFailed – 22952520-EC89-4FBD-94E0-B67DF88347F6 – Optional Component Migration Operation Failed ถึง Open Optional Component Package
  50. OptionalComponentInitCBSSessionFailed – 63340812-9252-45F3-A0F2-B2A4CA5E9317 – Corruption ใน Servicing Stack บน Down-level System
  51. DISMproviderFailure – D76EF86F-B3F8-433F-9EBF-B4411F8141F4 – Triggers เมื่อ DISM Provider (Plug-in) Fails ใน Critical Operation
  52. SysPrepLaunchModuleFailure – 7905655C-F295-45F7-8873-81D6F9149BFD – SysPrep Plug-in Failed ใน Critical Operation
  53. UserProvidedDriverInjectionFailure – 2247C48A-7EE3-4037-AFAB-95B92DE1D980 – Driver ที่ให้มาผ่าน Setup (Via Command Line Input) Failed ในบางทาง

ตัวอย่าง results.log file ให้ข้อมูล OS, Source และ Target Windows 10 Versions และ Error FindFatalPluginFailure:

Matching Profile found: FindFatalPluginFailure - E48E3F1C-26F6-4AFB-859B-BF637DA49636
System Information:
Machine Name = Offline
Manufacturer = VMware, Inc.
Model = VMware Virtual Platform
HostOSArchitecture = x64
FirmwareType = PCAT
BiosReleaseDate = 20160921000000.000000+000
BiosVendor = PhoenixBIOS 4.0 Release 6.0
BiosVersion = 6.00
HostOSVersion = 10.0.16299
HostOSBuildString = 16299.15.amd64fre.rs3_release.170928-1534
TargetOSBuildString = 10.0.17134.1 (rs4_release.180410-1804)
HostOSLanguageId = 1049
HostOSEdition = Professional
RegisteredAV =
FilterDrivers =
UpgradeStartTime = 4/10/2019 9:17:59 PM
UpgradeEndTime = 4/10/2019 10:10:36 PM
UpgradeElapsedTime = 00:52:37
ReportId = 004db4ee-17f9-4b6f-bc46-a8bd9877ccd8
Error: SetupDiag reports fatal migration plug-in failure. Plug-in Name = %windir%\system32\migration\CntrtextMig.dll, Migration Operation = IPostApply->ApplySuccess, Plug-in Error: 0x00000032

ในตัวอย่าง SetupDiag พบว่า Upgrade Installation ล้มเหลวเนื่องจาก Error ใน Plugin %windir%\system32\migration\CntrtextMig.dll

หาก System Upgrade สำเร็จ results.log จะมีข้อความ:

Matching Profile found: FindSuccessfulUpgrade - 8A0824C8-A56D-4C55-95A0-22751AB62F3E

SetupDiag Error: Main() failed with an unhandled exception

ในบางกรณีตอนรัน SetupDiag อาจเจอ Error: SetupDiag: Main() failed with an unhandled exception ใน Log

10:20:58 - SetupDiag: Main() failed with an unhandled exception:
Could not find a part of the path 'C:\$Windows.~bt\sources\rollback'.
Exception System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\$Windows.~bt\sources\rollback'.
Source: mscorlib
Stack: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileSystemEnumerableIterator`1.CommonInit()
at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)
at System.IO.DirectoryInfo.InternalGetFiles(String searchPattern, SearchOption searchOption)
at System.IO.DirectoryInfo.GetFiles(String searchPattern, SearchOption searchOption)
at Microsoft.Internal.Deployment.SetupDiag.CSetupAPIParser.GetCorrectSetupApiLog(String logsPath, DateTime dtSetupActLogTime)
at Microsoft.Internal.Deployment.SetupDiag.Directive.DirectiveDetermineDeviceInstallHang()
at Microsoft.Internal.Deployment.SetupDiag.Directive.DoDirective()
at Microsoft.Internal.Deployment.SetupDiag.CSetupDiag.RunDiag(String strRulesFile, String strlogsPath, String strMode, String strOutPut, String strFormat, String resLevel, Boolean fCreateLogs)
at Microsoft.Internal.Deployment.SetupDiag.Program.Main(String[] args)

ในกรณีของผม เนื่องจาก Log Folder หนึ่งหายไป แก้โดย Copy Logs ที่เหลือไปโฟลเดอร์เฉพาะและรัน SetupDiag ใน Offline Mode:

SetupDiag.exe /Output:C:\tools\Results.log /Mode:Offline /LogsPath:c:\Logs\

บาง Errors แก้ง่าย (เช่น Free Space ไม่พอบน System Volume) บางอันยากกว่า แต่ SetupDiag ช่วยวินิจฉัยและแก้ปัญหา Upgrade บนคอมพิวเตอร์ Windows 10 เร็วขึ้น และประหยัดความลำบากของ Admin ที่ต้อง Analyze Logs ด้วยตนเอง