About SetupDiag: Your Go-To Windows Upgrade Diagnostic Tool
Upgrading your Windows operating system should be a seamless process, bringing new features and enhanced security. However, sometimes, the update process can go awry, leaving you with frustrating error messages and an incomplete upgrade. When Windows upgrades fail, pinpointing the exact cause can feel like searching for a needle in a haystack. That’s where SetupDiag comes in – a powerful diagnostic tool designed to Run Diag and quickly identify why your Windows upgrade was unsuccessful.
Download the latest version of SetupDiag
SetupDiag is your expert assistant for troubleshooting Windows upgrade failures. This command-line tool meticulously examines Windows Setup log files, acting as a digital detective to parse through the technical jargon and pinpoint the root cause of the issue. Whether you’re dealing with a failed update on your own machine or assisting a client remotely, SetupDiag can be run directly on the problematic computer or in offline mode using exported logs.
Integrated directly within Windows Setup for all currently supported versions, SetupDiag.exe is automatically extracted to the %SystemDrive%$Windows.~btSources directory during the upgrade process. In cases of upgrade failure, Windows Setup automatically initiates SetupDiag to run diag and determine the failure’s origin.
When Windows Setup runs SetupDiag automatically, it utilizes specific parameters to streamline the diagnostic process:
/ZipLogs:False
/Format:xml
/Output:%windir%\logs\SetupDiag\SetupDiagResults.xml
/RegPath:HKEY_LOCAL_MACHINE\SYSTEM\Setup\SetupDiag\Results
The comprehensive analysis generated by SetupDiag can be accessed at %WinDir%LogsSetupDiagSetupDiagResults.xml
and within the registry at HKLMSYSTEMSetupSetupDiagResults
.
It’s important to note that when Windows Setup automatically runs SetupDiag, the registry path differs from the default path used when you manually run diag. Manual executions of SetupDiag, without specifying the /RegPath
parameter, store data under HKLMSYSTEMSetupMoSetupVolatileSetupDiag
.
A crucial tip when reviewing SetupDiag results: if multiple failures are indicated, focus on the last failure recorded in the log file. This typically represents the fatal error that halted the upgrade process, not necessarily the first error encountered.
If the Windows upgrade proceeds without issues, the Sources directory, including SetupDiag.exe, is moved under %SystemDrive%Windows.Old for cleanup. Deleting the Windows.old directory will also remove SetupDiag.exe.
Prerequisites to Run Diag with SetupDiag
Before you run diag with SetupDiag, ensure your system meets these essential requirements:
-
Supported Windows Versions: The target Windows version must be a currently supported version. The original Windows version can be unsupported as long as upgrading to the destination version is supported from the original installed version. Always check Microsoft’s official documentation for the latest compatibility information.
-
.NET Framework Requirement: .NET Framework 4.7.2 or a newer version must be installed. Most modern Windows systems already have this, but it’s worth verifying. To check the installed version, use this command in Command Prompt:
reg.exe query "HKLMSOFTWAREMicrosoftNet Framework SetupNDPv4" /s
As long as the minimum required .NET version is present, no further action is needed, even if a later version is installed.
-
Elevated Command Prompt: To ensure SetupDiag functions correctly and has the necessary permissions to access system logs, you must run diag from an elevated command prompt (Run as administrator).
How to Run Diag: Using SetupDiag Step-by-Step
Follow these simple steps to quickly run diag on your current computer using SetupDiag:
-
Verify Requirements: Double-check that your system meets the prerequisites outlined in the previous section.
-
Download SetupDiag: Click the download link: Download SetupDiag.
-
Save the File: When prompted by your browser, choose Save. The file will typically be saved to your Downloads folder. You can choose “Save As” to select a different location if preferred.
-
Locate Downloaded File: Open the folder where you saved SetupDiag. By default, this is the Downloads folder, easily accessible in File Explorer under “Quick access.”
-
Run SetupDiag: Double-click the SetupDiag file to execute it. If a User Account Control prompt appears asking for permission to run the program, click Yes.
Example of Registry Key Modification by SetupDiag: This image illustrates how SetupDiag can interact with the Windows Registry to store diagnostic results, enhancing its utility for system analysis.
When you double-click to run diag, the command window will automatically close upon completion. To keep the window open and review the messages generated by SetupDiag in real-time, you can run diag directly from the command prompt.
To do this:
a. Open an elevated Command Prompt (Run as administrator).
b. Navigate to the directory where you saved SetupDiag.exe using thecd
command (e.g.,cd Downloads
).
c. TypeSetupDiag
and press Enter. -
Wait for Analysis: A command window will appear, and SetupDiag will begin to run diag, analyzing your system for upgrade issues. Allow the process to complete without interruption.
-
Review the Log File: Once SetupDiag finishes, it will create two files in the same directory where SetupDiag.exe is located: a configuration file and the crucial log file. Open SetupDiagResults.log using Notepad or any text editor.
-
Interpret Results: Carefully review the information in the log file. If SetupDiag identifies a rule match, it will provide details about why the upgrade failed and, importantly, offer potential solutions to fix the problem. Refer to the “Rules” section below for detailed explanations of each rule and its implications.
For advanced usage, including running in offline mode or utilizing additional parameters, refer to the “Parameters” and “Examples” sections.
SetupDiag Parameters: Customizing Your Diagnostic Run
SetupDiag offers several optional parameters to tailor your diagnostic sessions. To see interactive help and a list of parameters, simply run diag with the /?
parameter:
SetupDiag.exe /?
Here’s a breakdown of the key parameters you can use to customize how you run diag:
Parameter | Description |
---|---|
/? |
Displays interactive help, listing available parameters and their usage. |
/Output:[LogFilePath] |
Specifies a custom file path and name for the output log file. This is useful for organizing results or saving them to a specific location. If the path contains spaces, enclose it in double quotes (e.g., "/Output:C:My Diagnostic LogsResults.log" ). Default: SetupDiagResults.log in the same directory as SetupDiag.exe . |
/LogsPath:[LogFolderPath] |
Specifies the path to the directory containing Windows Setup log files for offline analysis. SetupDiag will recursively search this directory and its subfolders for relevant logs. Default: Analyzes logs on the current system (online mode). |
/ZipLogs:[True|False] |
Instructs SetupDiag to create a ZIP archive containing the results log and all parsed log files. This is helpful for sharing diagnostic information or archiving. Default: True (creates a ZIP file). |
/Format:[xml|json] |
Sets the output format for the results log file to XML or JSON. If not specified, the default is text format (.log). |
/Scenario:[Recovery|Debug] |
– Recovery : Focuses SetupDiag to analyze reset and recovery logs, ignoring standard setup/upgrade logs. Useful for troubleshooting recovery failures. – Debug : Enables SetupDiag to debug memory dump files (.dmp ) if debugging tools are installed. |
/Verbose |
Generates a detailed diagnostic log file in the current directory, containing extensive debugging information about SetupDiag itself. Primarily useful when reporting issues with SetupDiag or for in-depth analysis of the tool’s operation. Default: Only logs major errors. |
/NoTel |
Prevents SetupDiag from sending diagnostic telemetry data to Microsoft. Use this for privacy-sensitive environments. |
/RegPath:[RegistryPath] |
Specifies a custom registry path where SetupDiag should store failure information. The path must start with HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER . Default: HKLMSYSTEMSetupMoSetupVolatileSetupDiag (manual run) or HKLMSYSTEMSetupSetupDiagResults (automatic run by Windows Setup). |