New-CMTSStepConditionSoftware
Create an installed software condition for a task sequence step.
Syntax
Default (Default)
New-CMTSStepConditionSoftware
[-IsAnyVersion <Boolean>]
-MsiFilePath <String>
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Use this cmdlet to create an installed software condition object for a task sequence step. Then use one of the New-CMTSStep* or Set-CMTSStep* cmdlets with the Condition or AddCondition parameters. For example, Set-CMTSStepApplyDataImage.
For more information, see Use the task sequence editor: Conditions.
Note
Run Configuration Manager cmdlets from the Configuration Manager site drive, for example PS XYZ:\>
. For more information, see getting started.
Examples
Example 1
This example first creates a condition object for the Configuration Manager console MSI.
It then uses the Set-CMTSStepRunPowerShellScript cmdlet to add this condition object to the Run PowerShell Script step of the Default OS deployment task sequence.
$msi = "\\cm01.contoso.com\SMS_XYZ\bin\i386\adminconsole.msi"
$condition = New-CMTSStepConditionSoftware -MsiFilePath $msi -IsAnyVersion $true
$tsNameOsd = "Default OS deployment"
$tsStepNameRunPwsh = "Run PowerShell Script"
Set-CMTSStepRunPowerShellScript -TaskSequenceName $tsNameOsd -StepName $tsStepNameRunPwsh -AddCondition $condition
This sample script creates the following condition on the step:
Software An version of "Microsoft Endpoint Configuration Manager Console" installed
Parameters
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | cf |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-DisableWildcardHandling
This parameter treats wildcard characters as literal character values. You can't combine it with ForceWildcardHandling.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-ForceWildcardHandling
This parameter processes wildcard characters and may lead to unexpected behavior (not recommended). You can't combine it with DisableWildcardHandling.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-IsAnyVersion
Use this parameter to determine how the condition matches the MSI codes:
$true
: Match any version of this product, MSI upgrade code only$false
: Match this specific product, MSI product code and upgrade code
If you don't specify this parameter, by default it matches the specific product.
Parameter properties
Type: | Boolean |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-MsiFilePath
Specify the path to the MSI file to evaluate. The cmdlet reads the product details from this MSI. The path to the MSI isn't saved, just the product details.
For example, it saves the following details for the Configuration Manager version 2107 AdminConsole.msi:
ProductCode
: {B3842C82-95EB-472C-940A-D82C4A10857D}ProductName
: Microsoft Endpoint Configuration Manager ConsoleUpgradeCode
: {B038D5E8-6C93-4A05-9E21-240324CFDF0E}Version
: 5.2107.1059.1000
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet doesn't run.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | wi |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs
None
Outputs
IResultObject
Notes
For more information on this return object and its properties, see SMS_TaskSequence_SoftwareConditionExpression server WMI class.