okieselbach / Intune

Intune Scripts and Helpers.
463 stars 187 forks source link

Get-CimInstance : A general error occurred that is not covered by a more specific error code. #14

Open lucafabbri365 opened 2 years ago

lucafabbri365 commented 2 years ago

Hello, the Get-WindowsAUtoPilotInfo.ps1 PowerShell scripts returns the error below on computers with latest Windows Updates (May 2022); it seems the KB5013942 is causing it (links: Microsoft Q&A, Reddit).

Get-CimInstance : A general error occurred that is not covered by a more specific error code.
At C:\Program Files\WindowsPowerShell\Scripts\Get-WindowsAutoPilotInfo.ps1:211 char:17
+ ... evDetail = (Get-CimInstance -CimSession $session -Namespace root/cimv ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-CimInstance], CimException
    + FullyQualifiedErrorId : MI RESULT 1,Microsoft.Management.Infrastructure.CimCmdlets.GetCimInstanceCommand

C:\Program Files\WindowsPowerShell\Scripts\Get-WindowsAutoPilotInfo.ps1 : Unable to retrieve device hardware data (hash) from computer localhost

Removing the KB above resolves the issue, however on some environment it isn't possible (Windows says this is a required security update and cannot be removed).

On a deep investigation (WMI Explorer), it appears there is no Instance for the class MDM_DevDetail_Ext01 under root/cimv2/mdm/dmmap namespace, causing the error above.

Maybe you already know about it, and I also understand it isn't a script issue, but more a WMI related issue.

What are your thoughts ?

Thank you, Luca