$configPath = "C:\Program Files (x86)\Microsoft Intune Management Extension\Microsoft.Management.Services.IntuneWindowsAgent.exe.config" $rootPath = "C:\Program Files (x86)\Microsoft Intune Management Extension" if (-not (Test-Path $configPath)) { Write-Output "[FAIL] Config file missing" exit 1 } $required = @( @{ Name = "Newtonsoft.Json"; PKT = "30ad4fe6b2a6aeed" } @{ Name = "System.Runtime.CompilerServices.Unsafe"; PKT = "b03f5f7f11d50a3a" } @{ Name = "Microsoft.Bcl.AsyncInterfaces"; PKT = "cc7b13ffcd2ddd51" } @{ Name = "System.Buffers"; PKT = "cc7b13ffcd2ddd51" } @{ Name = "System.Numerics.Vectors"; PKT = "b03f5f7f11d50a3a" } @{ Name = "System.Diagnostics.DiagnosticSource"; PKT = "cc7b13ffcd2ddd51" } @{ Name = "Microsoft.Extensions.Logging.Abstractions"; PKT = "adb9793829ddae60" } @{ Name = "System.ValueTuple"; PKT = "cc7b13ffcd2ddd51" } @{ Name = "System.Text.Encodings.Web"; PKT = "cc7b13ffcd2ddd51" } @{ Name = "System.Text.Json"; PKT = "cc7b13ffcd2ddd51" } ) try { [xml]$xml = Get-Content $configPath -ErrorAction Stop } catch { Write-Output "[FAIL] Config unreadable: $($_.Exception.Message)" exit 1 } $ns = New-Object System.Xml.XmlNamespaceManager($xml.NameTable) $ns.AddNamespace("asm", "urn:schemas-microsoft-com:asm.v1") $deps = $xml.SelectNodes("//configuration/runtime/asm:assemblyBinding/asm:dependentAssembly", $ns) $found = @{} foreach ($d in $deps) { $ai = $d.SelectSingleNode("asm:assemblyIdentity", $ns) $br = $d.SelectSingleNode("asm:bindingRedirect", $ns) if ($ai -and $ai.name) { $found[$ai.name] = @{ PKT = $ai.GetAttribute("publicKeyToken") New = $br.GetAttribute("newVersion") Old = $br.GetAttribute("oldVersion") } } } $bad = $false foreach ($req in $required) { $name = $req.Name $pkt = $req.PKT $dll = Join-Path $rootPath "$name.dll" if (-not (Test-Path $dll)) { Write-Output "[FAIL] ${name}: DLL missing from disk" $bad = $true continue } try { $asm = [System.Reflection.AssemblyName]::GetAssemblyName($dll) $version = $asm.Version.ToString() } catch { Write-Output "[FAIL] ${name}: DLL version unreadable" $bad = $true continue } if (-not $found.ContainsKey($name)) { Write-Output "[FAIL] ${name}: missing from config" $bad = $true continue } $entry = $found[$name] if ($entry.PKT -ne $pkt) { Write-Output "[FAIL] ${name}: PKT mismatch (config=$($entry.PKT) expected=$pkt)" $bad = $true } if ($entry.New -ne $version) { Write-Output "[FAIL] ${name}: Version mismatch (config=$($entry.New) dll=$version)" $bad = $true } } if ($bad) { Write-Output "[FAIL] IME config is not correct" exit 1 } Write-Output "[OK] IME config is correct" exit 0