MSEndpointMgr / ConfigMgr

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

Failed to decompress driver package content file #274

Open kbelcher83 opened 3 years ago

kbelcher83 commented 3 years ago

Hello Maurice, I'm attempting to do a FullOS Driver update. I'm using v3.0.9 of the Invoke-CMApplyDriverPackage.ps1 script. Unfortunately, I cannot use v4 yet as our centrally controlled SCCM environment has not been upgraded to 2002 yet (boo).

The command line parameters added to the script in the TS is: -URI "http:///ConfigMgrWebService/ConfigMgr.asmx" -SecretKey "" -Filter "Driver" -DeploymentType DriverUpdate

The package downloads just fine but when it attempts to decompress, it fails with: - Failed to decompress driver package content file. Error message: The argument is null or empty. Provide an argument that is not null or empty, and then try the command again. [ApplyDriverPackage]: Apply Driver Package process failed, please refer to previous error or warning messages

It appeared like it was being passed an invalid (null) parameter, but the logs didn't show the parameter's ($DriverPackageCompressedContent) value in the error message (line 1632). Then I noticed that $DriverPackageCompressedFile was set to the name of the actual zip file (added logging to show the parameter, see screenshot). Is line 1634 where you are using Expand-Archive supposed to reference $DriverPackageCompressedFile instead of it's Content counterpart?

kbelcher83 commented 3 years ago

Ok, I think I got it fixed. I'm not a coding/github expert and not sure if I can make a commit to suggest these changes, but here is how I fixed it: Line 1634 should use the below instead of $DriverPackageCompressedContent for the Path variable Expand-Archive -Path (Join-Path -Path $ContentLocation -ChildPath $DriverPackageCompressedFile) -DestinationPath $ContentLocation -Force -ErrorAction Stop

Lines 1647-1648 also need to be updated to reflect the correct path when the package gets deleted: if (Test-Path -Path (Join-Path -Path $ContentLocation -ChildPath $DriverPackageCompressedFile)) { Remove-Item -Path (Join-Path -Path $ContentLocation -ChildPath $DriverPackageCompressedFile) -Force -ErrorAction Stop

vbateman commented 3 years ago

kbelcher83. Thanks!, that worked!