MSEndpointMgr / ConfigMgr

Microsoft Endpoint Configuration Manager scripts and tools
637 stars 281 forks source link

Invoke-CMApplyDriverPackage.ps1 - Package content download process failed #14

Closed viriio closed 6 years ago

viriio commented 6 years ago

Hi,

Fantastic work, looks very promising. I'm hitting a slight issue with drivers trying download. I've tried to diagnose and looks to be failing after calling OSDDownloadContent.exe from WinPE. Line 230.

Particular section in smsts.log of concern is:

Moving package: XYZ0091E to destination location 'C:_SMSTaskSequence\DriverPackage\XYZ0091E' from download location '' <- Blank?

Which then triggers the below in ApplyDriverPackage.log "Package content download process failed with return code -2147024809"

Running 1706 of config manager 2.0 of the script

ApplyDriverPackage.log

Snip from smsts.log smsts logpic

viriio commented 6 years ago

A comment to this, I wonder if I can narrow this down by running the commands manually from a powershell session during the task sequence,

Does anyone know what these variable should be set to in a working environment? or has log files of a working site they'd be willing to share so I can do some comparisons.

Only one that I doesn't look right to me is: $DestinationVariableName but hard to know.

Bold is the variables from logs and what their currently set to. ` $PackageID=XYZ0091E $TSEnvironment.Value("OSDDownloadDownloadPackages") = "$($PackageID)"

$DestinationLocationType=Custom $TSEnvironment.Value("OSDDownloadDestinationLocationType") = "$($DestinationLocationType)"

$DestinationVariableName=OSDDriverPackage $TSEnvironment.Value("OSDDownloadDestinationVariable") = "$($DestinationVariableName)"

$CustomLocationPath = %_SMSTSMDataPath%\DriverPackage $TSEnvironment.Value("OSDDownloadDestinationPath") = "$($CustomLocationPath)" OSDDownloadContent.exe `

viriio commented 6 years ago

Trying to run the below. It does exactly the same as the smsts.log log above so I won't double post. It all looks promising until it tries to move the package.

$TSEnvironment = New-Object -ComObject Microsoft.SMS.TSEnvironment
$TSEnvironment.Value("OSDDownloadDownloadPackages") = "XYZ0091E"
$TSEnvironment.Value("OSDDownloadDestinationLocationType") = "Custom"
$TSEnvironment.Value("OSDDownloadDestinationVariable") = "OSDDriverPackage"
$TSEnvironment.Value("OSDDownloadDestinationPath") ="%_SMSTSMDataPath%\DriverPackage"
osddownloadcontent.exe

I get the same error messages as first logged. e.g. Highlighted in red in the image. Failed to move package Blah from '' to c:_SMSTaskSequence\Driverpackage\XYZ0091E

Any ideas? Still keen for someone to share their working log files.

NickolajA commented 6 years ago

Quick question, have you distributed that specific package?

viriio commented 6 years ago

Yeah that was my first thought also, appearing on detected DP, I can browse the unc path of the detected DP direct to the package. I also tried changing the package name to an existing package ID that I know works in the Task Sequence, same error. OSDDownloadContent does seem to set variables after failing to run, so from there can get the path from that and do a copy-item and the drivers copy down.

NickolajA commented 6 years ago

Are you running OSD in HTTPS or HTTP mode? I just verified the download process and it works well here.

viriio commented 6 years ago

HTTPS, you?

viriio commented 6 years ago

Hey NickolajA, some promising results today, while I didn't get a chance to watch it do the dism step I saw the successful download of the package in the logs and locally on the device.

Task Sequence -> Deployment options ->DP

Was set to "Access content directly from a distribution point when needed by the running task sequence", after changing to "Download content locally when needed by the running task sequence" the script is now downloading packages using the OSDDownloadContent.exe . Can also use the shortened sniplet that I posted earlier and it downloads the package correctly. tasksequencedeployment

Out of interested can you confirm if you have your TS set to"Download content locally when needed by the running task sequence" cheers.

NickolajA commented 6 years ago

Our labs are running in HTTP mode, we don't have the option (or time) to also validate for HTTPS environments unfortunately. I have it set with the default value, meaning it's not accessing it directly from the DP.

Glad that you got it working! Will close this issue, let us know if you have any other issues.

liza2277 commented 5 years ago

Is there a way around this? I’m seeing this issue after implementing it in our task sequence. We always set the option to access content directly from DP for any task sequence, else machines will fail to build. So this is not an option I can change.

carterscottm commented 5 years ago

I've just started using this myself and have made some headway in getting it fixed for my environment.

My task sequence also accesses content directly from the DP, so I've made changes to Invoke-CMApplyDriverPackage.ps1. My script queries the _SMSTSDownloadOnDemand TS variable, and when it's set to false, I run copy-item to download the package, rather than OSDDownloadContent.exe. I had to add an extra parameter to the code so I can specify the name of the content share to pull from. I'm still testing, but if it works out, I'll submit a PR with my changes.

The only problem with my code as it stands is that all the DPs need to have the same content share. My site server's share is SMSPKGF$, but the satellite DPs will most likely be SMSPKGD$. Maybe somebody smarter than myself can provide a way to determine the content share of the local DP programatically and the extra parameter can go away.