Use SetupDiag to diagnose Windows 10 upgrade issues
SetupDiag is a free diagnostic tool by Microsoft that is designed to find and parse Windows 10 setup log files to determine why an upgrade or update failed to install on a computer system.
The program can be run on the computer that failed to upgrade or on another computer if relevant log files are available (for example, by copying them to the PC).
SetupDiag works only on devices running Windows 10. The second requirement is that it depends on the Microsoft .NET Framework 4.6 which needs to be installed on the device it is run on.
With the upcoming Windows 10 version 1803 just around the corner, it may be the right tool to have in your arsenal if you run into upgrading issues.
You can run SetupDiag directly after download. If you run it without parameters, it attempts to locate log files that Windows 10 creates during the upgrade process in the default folders on the device.
The program creates a results.log file in its directory when it completes the scan which includes upgrade issues that it detected in the log files during parsing.
SetupDiag creates a zip archive of all log files that it processed on top of that which it saves as Logs.zip in the same directory as well.
The command line window lists those as well, but the window is closed automatically when the program finishes the scan.
Check out our list of Windows 10 upgrade log files to find out more about those. Basically, what SetupDiag does is parse the following directories for log files:
You may run the application in offline mode to parse folders copied from another device. The tool parses one folder only if you copy individual folders, but if you copy the parent folder, it will include all logs found in all directories of the directory structure.
SetupDiag can also be used to debug minidump files that Windows 10 may create during the upgrade process. Windows 10 creates the file setupmem.dmp either in %SystemDrive%$Windows.~bt\Sources\Rollback or in %WinDir%\Panther\NewOS\Rollback depending on when the upgrade process is stopped.
Here are some examples:
- SetupDiag.exe -- the core command. It will run in online mode which means that it tries to find upgrade logs on the target machine in the directories mentioned above.
- SetupDiag.exe /Output:C:\SetupDiag\Results.log /Mode:Offline /LogsPath:D:\Temp\Logs\LogSet1 - the command runs SetupDiag in offline mode. It will scan the directory LogSet1 for matching log files and issues.
- SetupDiag.exe /Output:C:\SetupDiag\Dumpdebug.log /Mode:Offline /LogsPath:D:\Dump -- the command analyzes the setupmem.dmp file found in d:\dump.
How it works
SetupDiag uses a set of rules files to find matches in upgrade logs. Rules have a name and associated unique identifier.
The reliance on rules means that SetupDiag can only identify issues that are defined in its set of rules. Microsoft lists a total of 26 unique identifiers on the Microsoft Docs website which SetupDiag identifies in its current version.
If the program fails to find the root cause for the upgrade issue, check out our how to analyze Windows 10 upgrade errors guide which offers information on diagnosing issues manually.
SetupDiag may speed up the diagnosing of upgrade related issues on Windows 10 machines significantly. It reduces the time it takes to parse the log files but may still require additional research to repair the detected issue.
Some issues, like not enough disk space, are easy enough to fix but others may require extensive research and repair operations.
Now You: Did you run into Windows 10 upgrade errors in the past?
About 6 mon. ago I got a laptop with 1607 on it. I was just starting to learn Win 10, then it kept failing at updating to 1703, let alone 1709. I used all MS troubleshooters I could find, but only when I stumbled on what I think was called MS ‘upgrader’ did it shoot me all the way to latest build 1709, in one update. Hope the ‘Spring’ one goes smoothy-woothy.
2:50:56 – SetupDiag: Main() failed with an unhandled exception:
The path is not of a legal form.
Exception System.ArgumentException: The path is not of a legal form.
Stack: at System.IO.Path.LegacyNormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.InternalGetDirectoryName(String path)
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)
Where can you download the SetupDiag.exe file?
There’s a link at the bottom to Microsoft Docs. Click that, scroll up for the download link.
i was wondering the same thing. is this Software we download and if so where is the link? Or is this something already in Windows 10 and we just run the command? The article make me think were supposed to download and install something, as the article says – “You can run SetupDiag directly after download.”
Rick, you go to the Microsoft Docs website mentioned in the article: https://docs.microsoft.com/en-us/windows/deployment/upgrade/setupdiag#requirements
It contains a link called SetupDiag.exe near the top which downloads the file to your system.
Same question like Bill Steiner.
I had hoped this would provide a solution to my gf laptop that won’t make it to Windows 10 1709… Sigh.
8:59:13 – SetupDiag: Main() failed with an unhandled exception:
tnx 1709 is failing constantly on this machine, but let me without a clue why.
i’ll check this one out.
SetupDiag: Main() failed with an unhandled exception
Stack: System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
Broken like the update itself.
I get this error:
SetupDiag was unable to find a relevant log file.
And all attempts to update my windows to build 1903 fail don’t report any error
DISM.exe /Online /Cleanup-image /Restorehealth
but the update fails.
I don’t have any strange driver.