New-CMTSStepDownloadPackageContent
Create a Download Package Content step, which you can add to a task sequence.
Syntax
New-CMTSStepDownloadPackageContent
-AddPackage <IResultObject[]>
[-ContinueDownload <Boolean>]
[-DestinationVariable <String>]
[-LocationOption <LocationType>]
[-Path <String>]
[-Condition <IResultObject[]>]
[-ContinueOnError]
[-Description <String>]
[-Disable]
-Name <String>
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
This cmdlet creates a new Download Package Content step object. Then use the Add-CMTaskSequenceStep cmdlet to add the step to a task sequence. For more information on this step, see Task sequence steps: Download package content.
Note
Run Configuration Manager cmdlets from the Configuration Manager site drive, for example PS XYZ:\>
. For more information, see getting started.
Examples
Example 1: Create a task sequence step with condition and add to a group
This example first sets variables for the necessary parameters. It then uses the New-CMTSStepDownloadPackageContent cmdlet to create the step, and saves that as a variable. It then adds the step to a task sequence in a specific group using the Set-CMTaskSequenceGroup cmdlet.
$TaskSequenceName = "Module - Download Driver Packages"
$Model = "Latitude E7470"
$GroupName = "Dell Drivers"
$ContentPackage = Get-CMPackage -Fast -Name "Driver Dell Latitude E7470"
$StepName = $ContentPackage.Name
$ConditionQuery = "Select * From Win32_ComputerSystem Where Model = `"$Model`""
$StepCondition = New-CMTSStepConditionQueryWMI -Namespace "root\cimv2" -Query $ConditionQuery
$PackageStep = New-CMTSStepDownloadPackageContent -AddPackage $ContentPackage -Name $StepName -LocationOption TaskSequenceWorkingFolder -DestinationVariable "DRIVERS" -Condition $StepCondition
Set-CMTaskSequenceGroup -TaskSequenceName $TaskSequenceName -StepName $GroupName -AddStep $PackageStep -InsertStepStartIndex 1
Parameters
-AddPackage
Specify one or more package objects to use with the step. To get this object, use the Get-CMPackage cmdlet.
Type: | IResultObject[] |
Aliases: | AddPackages |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Condition
Specify a condition object to use with this step. To get a condition object, use one of the step condition cmdlets. For example, New-CMTSStepConditionQueryWMI.
Type: | IResultObject[] |
Aliases: | Conditions |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ContinueDownload
Set this parameter to true
to continue downloading other packages in the list if a package download fails.
Type: | Boolean |
Aliases: | ContinueDownloadOnError |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ContinueOnError
Add this parameter to enable the step option Continue on error. When you enable this option, if the step fails, the task sequence continues.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Description
Specify an optional description for this task sequence step.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DestinationVariable
Use this parameter to save the package's path into a custom task sequence variable.
Type: | String |
Aliases: | DestinationVariableName |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Disable
Add this parameter to disable this task sequence step.
Type: | SwitchParameter |
Aliases: | DisableThisStep |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DisableWildcardHandling
This parameter treats wildcard characters as literal character values. You can't combine it with ForceWildcardHandling.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ForceWildcardHandling
This parameter processes wildcard characters and may lead to unexpected behavior (not recommended). You can't combine it with DisableWildcardHandling.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-LocationOption
Specify one of the following values for where the task sequence saves the package:
TaskSequenceWorkingFolder
: Use the task sequence working directory, which is also referred to as the task sequence cache.ClientCache
: Use the Configuration Manager client cache. By default, this path is%WinDir%\ccmcache
.CustomPath
: The task sequence engine first downloads the package to the task sequence working directory. It then moves the content to this path you specify. The task sequence engine appends the path with the package ID. When you use this option, set the path with the Path parameter.
Type: | LocationType |
Accepted values: | TaskSequenceWorkingFolder, ClientCache, CustomPath |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Name
Specify a name for this step to identify it in the task sequence.
Type: | String |
Aliases: | StepName |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Path
When you specify -LocationOption CustomPath
, use this parameter to specify the local path to save the package content. The task sequence engine appends the path with the package ID.
Type: | String |
Aliases: | DestinationCustomPath |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet doesn't run.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
None
Outputs
IResultObject
Notes
For more information on this return object and its properties, see SMS_TaskSequence_DownloadPackageContentAction server WMI class.