Skip to content

Instantly share code, notes, and snippets.

@SMSAgentSoftware
Created August 2, 2018 11:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save SMSAgentSoftware/660d66c042c7d34222bfb1748fe46c07 to your computer and use it in GitHub Desktop.
Save SMSAgentSoftware/660d66c042c7d34222bfb1748fe46c07 to your computer and use it in GitHub Desktop.
Searches the Windows 10 Setup Compatibility logs for upgrade hard blockers
# Searches the Windows 10 Setup Compatibility logs for upgrade hard blockers
# Find all the compatibility xml files
$SearchLocation = 'C:\$WINDOWS.~BT\Sources\Panther'
$CompatibilityXMLs = Get-childitem "$SearchLocation\compat*.xml" | Sort LastWriteTime -Descending
# Create an array to hold the results
$Blockers = @()
# Search each file for any hard blockers
Foreach ($item in $CompatibilityXMLs)
{
$xml = [xml]::new()
$xml.Load($item)
$HardBlocks = $xml.CompatReport.Hardware.HardwareItem | Where {$_.InnerXml -match 'BlockingType="Hard"'}
If($HardBlocks)
{
Foreach ($HardBlock in $HardBlocks)
{
$FileAge = (Get-Date).ToUniversalTime() - $item.LastWriteTimeUTC
$Blockers += [pscustomobject]@{
ComputerName = $env:COMPUTERNAME
FileName = $item.Name
LastWriteTimeUTC = $item.LastWriteTimeUTC
FileAge = "$($Fileage.Days) days $($Fileage.hours) hours $($fileage.minutes) minutes"
BlockingType = $HardBlock.CompatibilityInfo.BlockingType
Title = $HardBlock.CompatibilityInfo.Title
Message = $HardBlock.CompatibilityInfo.Message
}
}
}
}
# Report results
If ($Blockers)
{
$Blockers
# Export to file
#$Blockers | export-csv -Path "$env:SystemDrive\Windows\CCM\Logs\W10UpgradeHardBlockers.csv" -NoTypeInformation -UseCulture -Force
}
Else
{
Write-host "No hard blockers found"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment