MSEndpointMgr / Intune

Microsoft Intune scripts
MIT License
667 stars 247 forks source link

Invoke-MSIntuneDriverUpdate.ps1 XML Parse Error #44

Open wbauer-isd94 opened 2 years ago

wbauer-isd94 commented 2 years ago

On my Lenovo machine, the Invoke-MSIntuneDriverUpdate.ps1 update script seems to be failing to parse the catalog.xml file from Lenovo's website.

The console output indicates that the $global:LenovoModelXML variable is null.

You cannot call a method on a null-valued expression.
At [file path]\MSEndpointMgr\Intune\Drivers\Invoke-MSIntuneDriverUpdate.ps1:268 char:4
+             $global:LenovoModelXML.GetType().FullName | Out-Null
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

I did some debugging and the value $global:LenovoModelXML seems to be null because the script is having trouble parsing the catalog.xml file. The log shows the following:

<![LOG[Error: Cannot convert value "???<?xml version="1.0" encoding="utf-8"?>
<Products>
  <Product model="Tablet10" family="len" os="win10" build="*">
    <Queries>
      <Types>
            ...
            [truncated - goes on to show entire catalog.xml file]
            ...
</Products>" to type "System.Xml.XmlDocument". Error: "The specified node cannot be inserted as the valid child of this node, because the specified node is the wrong type."]LOG]!><time="19:34:24.399+-360" date="01-06-2022" component="DriverAutomationScript" context="[my username]" type="3" thread="18112" file="">

Could this be related to the XML file's UTF-8 encoding? Some sources seem to indicate that the ??? at the beginning of the file in the log may be a Byte Order Mark (BOM) that's causing problems with parsing.

It doesn't seem like this is specific to my environment, but I'd take any suggestions.

Thank you!