Windows 更新通常可以轻松安装在您的 PC 上。但有时它需要一些工作,尤其是在兼容性和补丁方面。如果您遇到此类更新失败错误,您首先必须手动搜索错误代码,然后查找故障排除步骤。这一切都耗费时间。所以,微软(Microsoft)想出了一个简单的解决方案——SetupDiag.exe。
SetupDiag.exe是一个独立的诊断工具,用于查找有关Windows 11/10升级安装失败的详细信息。如您所知,Windows 11/10中的更新过程已被彻底简化,但这并不意味着它总是没有问题,因此是该工具。
如何使用 SetupDiag.exe
SetupDiag.exe需要在您的 PC 上安装Microsoft .NET Framework 4 。该工具通过检查Windows 安装程序日志文件并对其进行解析来找到无法将计算机更新或升级到(Windows Setup)Windows 10的根本原因。SetupDiag可以在更新失败的计算机上运行,或者您可以将日志从计算机导出到另一个位置并在脱机模式下运行SetupDiag 。
一旦您启动并运行该工具,它也可用于执行检查和分析。每当Windows遇到可能会危及系统安全操作的情况时,系统就会停止。这种情况称为错误检查(bug check)。它通常也被称为a-
- 系统崩溃
- 内核错误
- 停止错误或 BSOD
此问题的典型原因是硬件设备、硬件驱动程序或某些相关软件。
如果在升级期间发生错误检查,Windows 安装程序(Windows Setup)会提取一个小型转储 ( setupmem.dmp ) 文件。
要调试与设置相关的错误检查,必须:
指定/Mode: Offline和/LogsPath参数并尝试从故障系统收集设置内存转储文件 (setupmem.dmp)。
请(Please)注意,您不能在联机模式下调试内存转储。
您将在以下任一位置找到Setupmem.dmp
%SystemDrive%$Windows.~bt\Sources\Rollback
或者
%WinDir%\Panther\NewOS\Rollback
取决于何时发生错误检查。
此后,您可以在运行SetupDiag的计算机上安装(SetupDiag)Windows 调试工具(Windows Debugging Tools)。如果您选择不带参数运行该工具,它会尝试在设备上的默认文件夹中查找 Windows 11/10 在升级过程中创建的日志文件。
扫描结束后,SetupDiag将在(SetupDiag)SetupDiag.exe所在的文件夹中生成Log.zip、SetupDiag.exe.config和SetupDiagResults.log。
扫描过程完成后,该程序还会在其目录中创建一个results.log 文件。(results.log file)解析过程中会在日志文件中快速检测到遇到的任何升级问题。
除上述内容外,SetupDiag 还会(SetupDiag)创建所有已处理日志文件的 zip 存档,并将Logs.zip文件也保存在同一目录中。
最后,还有一个选项甚至可以在离线模式下运行SetupDiag.exe来解析从另一台设备复制的文件夹。
SetupDiag工具现在包含在Windows 安装程序中(Windows Setup)
在Windows 10和Windows 11中,SetupDiag工具包含在Windows 安装程序(Windows Setup)中。
在升级过程中,Windows 安装程序(Windows Setup)会将其所有源文件解压缩到该%SystemDrive%$Windows.~btSources
目录。
现在,setupdiag.exe 也安装在此文件夹中,如果升级失败,SetupDiag工具将自动运行以找出失败的原因。
在这种情况下,使用以下参数:
/ZipLogs:False
/Format:xml
/Output:%windir%\logs\SetupDiag\SetupDiagResults.xml
/RegPath:HKEY_LOCAL_MACHINE\SYSTEM\Setup\SetupDiag\Results
生成的SetupDiag分析可在以下位置找到:
%WinDir%\Logs\SetupDiag\SetupDiagResults.xml
并在注册表下
HKLM\SYSTEM\Setup\SetupDiag\Results
- 如果升级过程正常进行,则会将包含 setupdiag.exe 的 Sources 目录移至下方
%SystemDrive%Windows.Old
以进行清理。 - 如果稍后删除Windows.old 目录,setupdiag.exe 也将被删除。
有关如何使用SetupDiag.exe的完整详细信息,您可以阅读此Microsoft Doc。
How to use SetupDiag.exe to diagnose Windows Upgrade errors
Windows Updates usually get installed on your PC without hasslеs. But there are occasions when it requires a bit of work, esрecially when it comes to compаtibility and patcheѕ. If you come acrоss such failed update errors, you first have to manually search the error code and then look for trоubleshooting stеps. All this consumes time. So, Microsoft has come up with a simple solυtion – SetupDiag.exe.
SetupDiag.exe is a standalone diagnostic tool for finding details about why a Windows 11/10 upgrade failed to install. As you know, the update process in Windows 11/10 has been thoroughly streamlined but that doesn’t mean it’s always problem-free and hence, the tool.
How to use SetupDiag.exe
SetupDiag.exe requires Microsoft .NET Framework 4 to be installed on your PC. The tool works by examining Windows Setup log files and parsing them to find the root cause of a failure to update or upgrade the computer to Windows 10. SetupDiag can be run on the computer that failed to update, or you can export logs from the computer to another location and run SetupDiag in offline mode.
Once you have the tool up and running, it can be used for performing checks and analyses also. Whenever Windows comes across a situation that likely intends to compromise safe system operation, the system halts. This condition is called a bug check. It is also commonly referred to as a-
- System crash
- Kernel error
- Stop error or BSOD
The typical cause for this issue is either a hardware device, hardware driver, or some related software.
If the bug check occurs during an upgrade, Windows Setup extracts a minidump (setupmem.dmp) file.
To debug a setup related bug check, one must:
Specify the /Mode: Offline and /LogsPath parameters and try gathering the setup memory dump file (setupmem.dmp) from the failing system.
Please note that you cannot debug memory dumps in online mode.
You will find Setupmem.dmp under either
%SystemDrive%$Windows.~bt\Sources\Rollback
Or
%WinDir%\Panther\NewOS\Rollback
depending on when the bug check occurs.
Thereafter, you can install the Windows Debugging Tools on the computer that runs SetupDiag. If you chose to run the tool without parameters, it attempts to locate log files that Windows 11/10 creates during the upgrade process in the default folders on the device.
Once the scan is over, SetupDiag will generate Log.zip, SetupDiag.exe.config, and SetupDiagResults.log in the folder where the SetupDiag.exe is located.
The program also creates a results.log file in its directory after the completion of the scanning process. Any upgrade issues encountered are rapidly detected in the log files during parsing.
Apart from the above, SetupDiag creates a zip archive of all logfiles that is processed and also saves Logs.zip file in the same directory as well.
Lastly, there’s an option to even run SetupDiag.exe in offline mode to parse folders copied from another device.
SetupDiag tool is now included with Windows Setup
In Windows 10 and Windows 11, SetupDiag tool is included with Windows Setup.
During the upgrade process, Windows Setup will extract all its sources files to the %SystemDrive%$Windows.~bt\Sources
directory.
Now, setupdiag.exe is also installed in this folder and in case the upgrade fails, SetupDiag tool will automatically run to find out why it failed.
In this scenario, the following parameters are used:
/ZipLogs:False
/Format:xml
/Output:%windir%\logs\SetupDiag\SetupDiagResults.xml
/RegPath:HKEY_LOCAL_MACHINE\SYSTEM\Setup\SetupDiag\Results
The resulting SetupDiag analysis can be found at:
%WinDir%\Logs\SetupDiag\SetupDiagResults.xml
and in the Registry under
HKLM\SYSTEM\Setup\SetupDiag\Results
- If the upgrade process proceeds normally, the Sources directory including setupdiag.exe is moved under
%SystemDrive%\Windows.Old
for cleanup. - If the Windows.old directory is deleted later, setupdiag.exe will also be removed.
For full details on how to use SetupDiag.exe you can read this Microsoft Doc.