MSEndpointMgr / ConfigMgr

Microsoft Endpoint Configuration Manager scripts and tools
628 stars 282 forks source link

Invoke-CMApplyDriverPackage.ps1 not using $FallBackSKU #202

Open CornHead764 opened 4 years ago

CornHead764 commented 4 years ago

So I was attempting to use this script on a Dell Optiplex 7010, and the script kept failing. Looking at the logs, below is what it was detecting:

-Manufacturer determined as: Dell -Computer model determined as: OptiPlex 7010 -Computer SKU determined as: OptiPlex 7010 -Fallback SKU determined as: 0577

After this, once it finds the 7010 driver package, we see this in the logs:

-Attempting to find a match for driver package: Drivers - Dell OptiPlex 7010 - Windows 10 x64 -Unable to match computer model using detection method: SystemSKU (OptiPlex 7010) -Fallback from SystemSKU match found for computer model instead using detection method: SystemSKU -Driver package does not meet computer model, manufacturer and operating system and architecture criteria: Drivers - Dell OptiPlex 7010 - Windows 10 x64

So we can see the script detects the SKU as a fallback, and the model as the SKU. I didn't dig into the SKU detection logic, but figured I'd look at the fallback, as if it's detecting that, it should still work. Looking at the script, there are only 3 references to the $FallBackSKU variable. and those are as follows:

Line 598: $FallBackSKU = [regex]::Matches($OEMString, '\[\S*]')[0].Value.TrimStart("[").TrimEnd("]")

Line 610-612: if (-not ([string]::IsNullOrEmpty($FallBackSKU))) { Write-CMLogEntry -Value "Fallback SKU determined as: $FallBackSKU" -Severity 1 }

So really, the variable is detected, filled, and logged, but never used.

To make it work, I simply added a clause to the if statement on line 813, which now reads: if (($Package.PackageManufacturer -match $ComputerManufacturer) -and ($Package.PackageName -match $OSName) -and ($Package.PackageName -match $OSImageArchitecture) -and (($Package.PackageDescription -match $SystemSKU) -or ($Package.PackageDescription -match $FallBackSKU))) {

The change is the statement after the last -and. Previously, it didn't reference the $FallBackSKU variable, but now that it does, if either the $SystemSKU or $FallBackSKU are in the package description (which was already the case with the 7010), then the statement will evaluate as true.

This worked as a fix at 4:45, so there may be a better way to fix this, but that's what I found that worked for my scenario. Please let me know if you need any additional information, validation, or testing.

timothyd09 commented 4 years ago

Having this same issue and I simply commented out the validation "(($Package.PackageDescription -match $SystemSKU)" as it has already been evaluated in the previous section so I didn't feel it needed to be evaluated again.

celadyn commented 4 years ago

Having the same issue with a Dell Optiplex 7010. Both model and SKU (0577) detection fail and no drivers are installed. About to dive into the script and make some change similar to the above commenters :) wonder why it's just this one that fails? No other model appears to generate the same behavior (that I've seen).

Manufacturer determined as: Dell
Computer model determined as: OptiPlex 7010
Computer SKU determined as: OptiPlex 7010
Fallback SKU determined as: 0577
...
Attempting to find a match for driver package: Drivers - Dell Optiplex 7010 - Windows 10 x64   (CCM00C03)
Unable to match computer model using detection method: SystemSKU (OptiPlex 7010)
Fallback from SystemSKU match found for computer model instead using detection method: SystemSKU (OptiPlex 7010)
Driver package does not meet computer model, manufacturer and operating system and architecture criteria: Drivers - Dell Optiplex 7010 - Windows 10 x64 (CCM00C03)
NickolajA commented 4 years ago

Could you please try the 3.0.0 version of the script to see if the UseDriverFallback parameter and functionality works better for you?

https://github.com/SCConfigMgr/ConfigMgr/blob/master/Operating%20System%20Deployment/Drivers/Invoke-CMApplyDriverPackage_3.0.0_Preview.ps1

NickolajA commented 4 years ago

Any update?

shaylesh commented 4 years ago

Hi Nickolaj,

Is the Dell Optiplex 7010 issue fixed in version 3.0.0 ? I am facing exactly same issue.

NickolajA commented 4 years ago

Use the new improved DebugMode where you can test if any model will match the correct driver package. An example is on our docs page on the blog. I can't remember this specific issue though.

agrooms commented 4 years ago

The Dell Optiplex 3020M exhibits the same behavior

NickolajA commented 4 years ago

Could you share the full ApplyDriverPackage.log from that model?

agrooms commented 4 years ago

Attached

Allen L. Grooms | IS Network Analyst Information Systems | Great River Health 1221 South Gear Ave. | West Burlington, IA 52655 Office: 319-768-4466 | Department: 319-768-4400 www.greatrivermedical.orghttp://www.greatrivermedical.org/ www.Facebook.com/GreatRiverHealthhttp://www.Facebook.com/GreatRiverHealth | www.Twitter.com/GreatRiverMedhttp://www.twitter.com/GreatRiverMed

Information in this communication, including attachments, is confidential and intended only for the addressee(s). This communication may contain privileged, confidential, proprietary or trade secret information entitled to protection or exemption from disclosure under law. If you are not an intended recipient, please know that any use, distribution or copying of this communication, or any action taken based on the information in this communication, is unauthorized and may be unlawful. If you received this communication in error, please notify the sender and delete this communication from your device.

From: Nickolaj Andersen notifications@github.com Sent: Monday, March 23, 2020 12:02 PM To: SCConfigMgr/ConfigMgr ConfigMgr@noreply.github.com Cc: Allen L Grooms ALGrooms@grhs.net; Comment comment@noreply.github.com Subject: Re: [SCConfigMgr/ConfigMgr] Invoke-CMApplyDriverPackage.ps1 not using $FallBackSKU (#202)

EXTERNAL EMAIL: This email originated outside of the GRHS email system. DO NOT CLICK links or attachments unless you recognize the sender and know the content is safe.

Could you share the full ApplyDriverPackage.log from that model?

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/SCConfigMgr/ConfigMgr/issues/202#issuecomment-602729688, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AO5JANN3E7JZPWB7EDP7C63RI6IXPANCNFSM4J57BE7Q.

agrooms commented 4 years ago

ApplyDriverPackage.zip

agrooms commented 4 years ago

I can confirm the same on the Dell Optiplex 7010 as reported earlier. I can force the update again and pull that log if would help.

NickolajA commented 4 years ago

That's not using the latest version 3.0.0, it's using version 2.2.7. Could you test with the new, please? A lot of the logic has been re-written.

agrooms commented 4 years ago

Agreed, I am not on the beta/preview. I will download it and give it a try tomorrow. Sorry if my post was misleading to make you think I was using the 3.0 version.

Please forgive any grammar and typing issues as this response is being sent from a mobile device.

Allen L. Grooms


From: Nickolaj Andersen notifications@github.com Sent: Monday, March 23, 2020 5:01:27 PM To: SCConfigMgr/ConfigMgr ConfigMgr@noreply.github.com Cc: Allen L Grooms ALGrooms@grhs.net; Comment comment@noreply.github.com Subject: Re: [SCConfigMgr/ConfigMgr] Invoke-CMApplyDriverPackage.ps1 not using $FallBackSKU (#202)

EXTERNAL EMAIL: This email originated outside of the GRHS email system. DO NOT CLICK links or attachments unless you recognize the sender and know the content is safe.

That's not using the latest version 3.0.0, it's using version 2.2.7. Could you test with the new, please? A lot of the logic has been re-written.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/SCConfigMgr/ConfigMgr/issues/202#issuecomment-602879810, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AO5JANMUI24523EQKDA7NILRI7L3PANCNFSM4J57BE7Q.

NickolajA commented 4 years ago

No worries, it's actually not in Preview anymore. Was released this weekend!

agrooms commented 4 years ago

I can confirm that the new 3.0 version fixed the issue with the Dell Optiplex 3020M issue. Will try and find a 7010 to test next.

Allen L. Grooms | IS Network Analyst Information Systems | Great River Health 1221 South Gear Ave. | West Burlington, IA 52655 Office: 319-768-4466 | Department: 319-768-4400 www.greatrivermedical.orghttp://www.greatrivermedical.org/ www.Facebook.com/GreatRiverHealthhttp://www.Facebook.com/GreatRiverHealth | www.Twitter.com/GreatRiverMedhttp://www.twitter.com/GreatRiverMed

Information in this communication, including attachments, is confidential and intended only for the addressee(s). This communication may contain privileged, confidential, proprietary or trade secret information entitled to protection or exemption from disclosure under law. If you are not an intended recipient, please know that any use, distribution or copying of this communication, or any action taken based on the information in this communication, is unauthorized and may be unlawful. If you received this communication in error, please notify the sender and delete this communication from your device.

From: Nickolaj Andersen notifications@github.com Sent: Monday, March 23, 2020 5:09 PM To: SCConfigMgr/ConfigMgr ConfigMgr@noreply.github.com Cc: Allen L Grooms ALGrooms@grhs.net; Comment comment@noreply.github.com Subject: Re: [SCConfigMgr/ConfigMgr] Invoke-CMApplyDriverPackage.ps1 not using $FallBackSKU (#202)

EXTERNAL EMAIL: This email originated outside of the GRHS email system. DO NOT CLICK links or attachments unless you recognize the sender and know the content is safe.

No worries, it's actually not in Preview anymore. Was released this weekend!

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/SCConfigMgr/ConfigMgr/issues/202#issuecomment-602882636, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AO5JANIRKRN7QY4HC2VEY3DRI7MWPANCNFSM4J57BE7Q.

NickolajA commented 4 years ago

Great to hear! Looking forward to the results from the other model.

agrooms commented 4 years ago

I can confirm that the Dell OptiPlex 7010 is now working as well with the new Update Drivers script.

MANY thanks to you and your team for developing these AWESOME tools.

Allen L. Grooms | IS Network Analyst Information Systems | Great River Health 1221 South Gear Ave. | West Burlington, IA 52655 Office: 319-768-4466 | Department: 319-768-4400 www.greatrivermedical.orghttp://www.greatrivermedical.org/ www.Facebook.com/GreatRiverHealthhttp://www.Facebook.com/GreatRiverHealth | www.Twitter.com/GreatRiverMedhttp://www.twitter.com/GreatRiverMed

Information in this communication, including attachments, is confidential and intended only for the addressee(s). This communication may contain privileged, confidential, proprietary or trade secret information entitled to protection or exemption from disclosure under law. If you are not an intended recipient, please know that any use, distribution or copying of this communication, or any action taken based on the information in this communication, is unauthorized and may be unlawful. If you received this communication in error, please notify the sender and delete this communication from your device.

From: Nickolaj Andersen notifications@github.com Sent: Monday, March 23, 2020 6:55 PM To: SCConfigMgr/ConfigMgr ConfigMgr@noreply.github.com Cc: Allen L Grooms ALGrooms@grhs.net; Comment comment@noreply.github.com Subject: Re: [SCConfigMgr/ConfigMgr] Invoke-CMApplyDriverPackage.ps1 not using $FallBackSKU (#202)

EXTERNAL EMAIL: This email originated outside of the GRHS email system. DO NOT CLICK links or attachments unless you recognize the sender and know the content is safe.

Great to hear! Looking forward to the results from the other model.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/SCConfigMgr/ConfigMgr/issues/202#issuecomment-602922125, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AO5JANI2WH5NJEYT5UUHPFTRI7ZFLANCNFSM4J57BE7Q.

timothyd09 commented 4 years ago

Thanks for working on this bug. I haven't had any time to test it with everyone moving to remote work, but I will give it a shot when I have a chance.

Regards,

Tim De Haan Domain Architect / SCCM Administrator Operations Infrastructure & Applications Health Sciences Technology (HST) University of Minnesota tdehaan@umn.edu tdehaan@umn.edu 612-301-1479

On Mon, Mar 23, 2020 at 8:35 PM agrooms notifications@github.com wrote:

I can confirm that the Dell OptiPlex 7010 is now working as well with the new Update Drivers script.

MANY thanks to you and your team for developing these AWESOME tools.

Allen L. Grooms | IS Network Analyst Information Systems | Great River Health 1221 South Gear Ave. | West Burlington, IA 52655 Office: 319-768-4466 | Department: 319-768-4400 www.greatrivermedical.orghttp://www.greatrivermedical.org/ www.Facebook.com/GreatRiverHealthhttp://www.Facebook.com/GreatRiverHealth | www.Twitter.com/GreatRiverMedhttp://www.twitter.com/GreatRiverMed

Information in this communication, including attachments, is confidential and intended only for the addressee(s). This communication may contain privileged, confidential, proprietary or trade secret information entitled to protection or exemption from disclosure under law. If you are not an intended recipient, please know that any use, distribution or copying of this communication, or any action taken based on the information in this communication, is unauthorized and may be unlawful. If you received this communication in error, please notify the sender and delete this communication from your device.

From: Nickolaj Andersen notifications@github.com Sent: Monday, March 23, 2020 6:55 PM To: SCConfigMgr/ConfigMgr ConfigMgr@noreply.github.com Cc: Allen L Grooms ALGrooms@grhs.net; Comment < comment@noreply.github.com> Subject: Re: [SCConfigMgr/ConfigMgr] Invoke-CMApplyDriverPackage.ps1 not using $FallBackSKU (#202)

EXTERNAL EMAIL: This email originated outside of the GRHS email system. DO NOT CLICK links or attachments unless you recognize the sender and know the content is safe.

Great to hear! Looking forward to the results from the other model.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub< https://github.com/SCConfigMgr/ConfigMgr/issues/202#issuecomment-602922125>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/AO5JANI2WH5NJEYT5UUHPFTRI7ZFLANCNFSM4J57BE7Q>.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/SCConfigMgr/ConfigMgr/issues/202#issuecomment-602956034, or unsubscribe https://github.com/notifications/unsubscribe-auth/AL6LJMB7JDLPVLBZHZ73J6TRJAE65ANCNFSM4J57BE7Q .

agrooms commented 4 years ago

Sorry to be a pain in the butt. I am expanding my testing and am finding that my HP 840 laptops are not working now. The script seems to find the appropriate manufacturer and model and sees that there are two driver packages but then abort. See attached log file. Thanks in advance for your support and assistance.

agrooms commented 4 years ago

ApplyDriverPackage.zip