Simplify Resolving Windows 10 Upgrade Errors with SetupDiag and ConfigMgr

A few weeks ago Microsoft released a handy tool to help diagnose issues with Windows 10 upgrades called SetupDiag. The tool basically analyzes the Windows Setup logs against known issues and reports it’s findings in a log file. Troubleshooting Windows 10 setup is not the most fun activity, so using this tool certainly makes the process easier. To make it easier still, we can run it using SCCM, either standalone, or as part of a Windows 10 Upgrade task sequence.

Below is a simple PowerShell script wrapper that can be used to run the tool. It checks that the requirement of .Net 4.6 has been met then runs the tool, logging to the location you specify. In this example I am logging the results to the CCM Logs directory for convenience. It creates a file called Setupdiagresults.log and an archive called Logs.zip containing the Windows setup logs used.

# Script to run SetupDiag to troubleshoot Windows 10 Setup
# Download SetupDiag.exe from https://go.microsoft.com/fwlink/?linkid=870142 and place in same directory as this script
# Get the CCM Logs location from registry
$LogLocation = Get-ItemProperty Path "HKLM:\SOFTWARE\Microsoft\CCM\Logging\@Global" Name LogDirectory | Select ExpandProperty LogDirectory
#$LogLocation = "$env:SystemRoot\CCM\Logs"
# Get the location we're running from (or use $PSScriptRoot)
$ScriptPath = Split-Path $MyInvocation.MyCommand.Path Parent
# Check that .Net 4.6 minimum is installed
If (Get-ChildItem "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\" | Get-ItemPropertyValue Name Release | ForEach-Object { $_ -ge 393295 })
{
Try
{
Start-Process FilePath "$ScriptPath\SetupDiag.exe" ArgumentList "/Output:$LogLocation\SetupDiagResults.log" Wait ErrorAction Stop
}
Catch
{
"[ERROR] There was an error starting SetupDiag.exe: $_" | Out-file FilePath "$LogLocation\SetupDiagResults.log" Force
}
}
Else
{
"[ERROR] .Net Framework 4.6 is required to run SetupDiag.exe" | Out-file FilePath "$LogLocation\SetupDiagResults.log" Force
}

view raw
Run-SetupDiag.ps1
hosted with ❤ by GitHub

Download the SetupDiag utility from here, and create a package in SCCM containing both SetupDiag.exe and the PS script in the same directory.

Add a Run PowerShell Script step to your task sequence and reference the package you created.

SetupTS

Here’s an example log file output from a successful upgrade:

SuccessfulUpgrade