1

Seems that New-CMTaskSequenceDeployment / Set-CMTaskSequenceDeployment cmdlet option -DeploymentOption does not work as expected.

I'm trying to automate a Task Sequence Deployment via Powershell. I use New-CMTaskSequenceDeployment cmdlet to create the deployment. The content of the TS should be downloaded before the start of the TS.

Works ok, but the -DeploymentOption DownloadAllContentLocallyBeforeStartingTaskSequence seems not to have any effect, when I check the deployment after the script ran, the option "pre-download content for this task sequence" isn't checked.

Same issue when I try Set-CMTaskSequenceDeployment.

Any hint from the community what I'm doing wrong?

...

# Create deployment for all waves now
foreach ($StrCollectionName in $ArrCollectionName) 
{
    $SchedulePhase2 = New-CMSchedule -Nonrecurring -Start $DateScheduleStartPhase2
    Try {
         $Deployment = New-CMTaskSequenceDeployment -CollectionName $StrCollectionName -TaskSequencePackageId $StrTaskSequenceID -DeployPurpose Required -AvailableDateTime $DateAvailablePhase1 -DeploymentOption DownloadAllContentLocallyBeforeStartingTaskSequence -SoftwareInstallation $False -SystemRestart $False -Schedule $SchedulePhase2 -RerunBehavior RerunIfFailedPreviousAttempt -AllowUsersRunIndependently $True -SendWakeUpPacket $True
        Write-Host "Success - Deployment $Deployment created!"
    } 
    Catch {
        Write-Host "Error - Exception caught in creating deployment : $error[0]"
        Exit
    }
}
...
  • ok, I learned that -DeploymentOption does not set the "Pre-Download" checkbox in the SCCM management console, but affects the deployment option setting in the "Distrbution Points" tab. Seems that there's no option to set the "Pre-Download" option :-( – Samuel Blaettler Aug 07 '19 at 11:55
  • Might be possible to set it via some wmi class, would this be an option for you or does nit have to be via cmdlets? – Syberdoor Aug 07 '19 at 15:34

2 Answers2

0

Looks like unfortunately (and unexpected) the pre-download behavior is different for package/program deployment and task sequence deployment. In case of a package/program deployment the content download will start after start time in case the deployment has a mandatory time defined. A TS deployment behaves different. It will start download when mandatory time (schedule) has been reached. Start time will be ignored. This difference is independently from how the deployment has been started (Console or powershell cmdlet) therefore it is not an issue of the cmdlet.

Marcel
  • 1
0

First of all, you can check the picture below to make sure not to confuse these two options.

Difference between Preload content checkbox and Download all content locally before starting TS

Once done Here is my proposition :

Just by clicking, try to retrieve the property of you TSDeployment before and after you clicked the checkbox. You will see that one property changed. AdvertFlags

PS MUZ:\> (Get-CMTaskSequenceDeployment -DeploymentID MUZ200C5).AdvertFlags
[Convert]::ToString((Get-CMTaskSequenceDeployment -DeploymentID MUZ200C5).AdvertFlags,2)
Output : 
34275328
10000010110000000000000000

From there, you can read from the MS doc : https://learn.microsoft.com/en-us/configmgr/develop/reference/core/servers/configure/sms_advertisement-server-wmi-class

From this, I learn that I need to change the 12th bit like this :

$advertflag = Get-CMTaskSequenceDeployment -DeploymentID MUZ200C5
$advertflag.AdvertFlags = $advertflag.AdvertFlags -bor "0x00001000"
$advertflag.put()

I hope it will help someone someday :)