MSEndpointMgr / ModernDriverManagement

Official repo of Modern Driver Management from MSEndpointMgr.com
https://www.msendpointmgr.com
MIT License
130 stars 74 forks source link

Surface Devices With : in SKU fail driver detection #196

Open Kevinnns opened 1 year ago

Kevinnns commented 1 year ago

Hi,

As the Driver Automation Tool has received a fix to support : in SKU names of Microsoft Surface Devices, I've found the latest version (and version before) unable to detect the driver for the system.

In trying to track down the issue, I think it is related to line 1350, where the DriverPackageDetails object gets build and the SystemSKU populated.

It seems if I change line 1350 SystemSKU = $DriverPackageItem.Description.Split(":").Replace("(", "").Replace(")", "")[1] to SystemSKU = $DriverPackageItem.Description.Replace("Models included:","").Replace("(", "").Replace(")", "") it seems to fix it for me and I don't see it breaking anything else.

Based on what I see happening in my testing, it looks like the initial Split based on : and then selecting returned object 1 is used to not populate the SystemSKU with Models included:. Otherwise I don't see any reason to attempting to split it in multiple objects and we just want to end up with whatever is in the Package Comment without the "(" & ")" & "Models Included:". But I'm not sure if it that choice has been made because of other reasons with other vendors.

Hope I'm not totally off with above and it can help fix the issue in this nice PowerShell script to support SystemSKU's that have : in it (under the assumption it's been set correctly in the SCCM Package details).

Kind regards,

Kevin

HermannGaetan commented 1 year ago

Hi,

I had the same problem and solved it with this fix (only for Microsoft models): SystemSKU = $(if ($DriverPackageItem.Manufacturer -imatch 'Microsoft') { $DriverPackageItem.Description.Replace("Models included:","").Replace("(", "").Replace(")", "") } else { $DriverPackageItem.Description.Split(":").Replace("(", "").Replace(")", "")[1] })

Best regards Gaétan