Created
August 2, 2018 11:25
-
-
Save SMSAgentSoftware/660d66c042c7d34222bfb1748fe46c07 to your computer and use it in GitHub Desktop.
Searches the Windows 10 Setup Compatibility logs for upgrade hard blockers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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