Use SetupDiag to diagnose Windows 10 upgrade issues

Martin Brinkmann
Apr 5, 2018
Updated • Apr 6, 2018
Windows, Windows 10
|
12

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.

Using SetupDiag

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:

  • \$Windows.~bt\sources\panther
  • \$Windows.~bt\Sources\Rollback
  • \Windows\Panther
  • \Windows\Panther\NewOS

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.

Closing Words

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?

Summary
Use SetupDiag to diagnose Windows 10 upgrade issues
Article Name
Use SetupDiag to diagnose Windows 10 upgrade issues
Description
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.
Author
Publisher
Ghacks Technology News
Logo
Advertisement

Tutorials & Tips


Previous Post: «
Next Post: «

Comments

  1. joe said on September 12, 2019 at 2:20 pm
    Reply

    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
    sfc /scannow
    but the update fails.

    I don’t have any strange driver.

  2. GL said on May 13, 2018 at 9:51 am
    Reply

    SetupDiag: Main() failed with an unhandled exception
    „C:\$WINDOWS.~BT\Sources\Panther\%systemdrive%\debuggers”.

    Source: mscorlib

    Stack: System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

    Broken like the update itself.

  3. Ann said on April 9, 2018 at 4:40 pm
    Reply

    tnx 1709 is failing constantly on this machine, but let me without a clue why.

    i’ll check this one out.

  4. CLalanne said on April 7, 2018 at 3:01 am
    Reply

    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:

  5. Robert G. said on April 6, 2018 at 2:30 am
    Reply

    Same question like Bill Steiner.

  6. Bill Steiner said on April 5, 2018 at 3:15 pm
    Reply

    Where can you download the SetupDiag.exe file?

    1. Rick A. said on April 6, 2018 at 12:51 am
      Reply

      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.”

      1. Martin Brinkmann said on April 6, 2018 at 6:18 am
        Reply

        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.

      2. Rick A. said on April 6, 2018 at 7:34 pm
        Reply

        Alright, Thanks.

    2. bobsmagicbeans said on April 5, 2018 at 11:00 pm
      Reply

      There’s a link at the bottom to Microsoft Docs. Click that, scroll up for the download link.

  7. Frank Martin said on April 5, 2018 at 10:54 am
    Reply

    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.
    Source: mscorlib
    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.Directive.DirectiveDebugMemoryDump()
    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)

  8. Stirred not shaken said on April 5, 2018 at 6:44 am
    Reply

    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.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.