Edit

Share via


Add-CMCIDetectionMethod

Specify how the client detects an application.

Syntax

Default (Default)

Add-CMCIDetectionMethod
    [-InputObject] <IResultObject>
    -DetectionOption <ApplicationDetectionMethod>
    [-MsiFilePath <String>]
    [-IsPerUserInstallation <Boolean>]
    [-ScriptFile <String>]
    [-ScriptLanguage <ScriptingLanguage>]
    [-ScriptText <String>]
    [-ApplicationName <String>]
    [-DeploymentTypeId <String>]
    [-PassThru]
    [-DisableWildcardHandling]
    [-ForceWildcardHandling]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

This cmdlet specifies how the client detects an application on the device. There are three detection methods: Windows Installer detection, detection by a specific application and deployment type, and a custom script to detect the application.

Examples

Example 1: Windows Installer detection

$ci = Get-CMConfigurationItem -Name "testCI"

$msiFilePath = "C:\tools\CCMTools\Orca.Msi"

$ci | Add-CMCIDetectionMethod -DetectionOption Msi -MsiFilePath $msiFilePath

Example 2: Specific app and deployment type

$ci = Get-CMConfigurationItem -Name "testCI"

$ci | Add-CMCIDetectionMethod -DetectionOption DeploymentType -ApplicationName "testApp" -DeploymentTypeId "392672"

Example 3: Custom script detection

$ci = Get-CMConfigurationItem -Name "testCI"

$scriptFile  = "C:\share\testScript.ps1"

$ci | Add-CMCIDetectionMethod -DetectionOption Script -ScriptLanguage PowerShell -ScriptFile $scriptFile

Parameters

-ApplicationName

When you set the DetectionOption to DeploymentType, use this parameter to specify the name of a Configuration Manager application. Use this parameter with DeploymentTypeID.

Parameter properties

Type:String
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

-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

-DeploymentTypeId

When you set the DetectionOption to DeploymentType, use this parameter to specify the ID of deployment type of the Configuration Manager application. Use this parameter with ApplicationName.

To get the deployment type ID, use the Get-CMDeploymentType cmdlet, and reference the CI_ID property.

Parameter properties

Type:String
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

-DetectionOption

Specify the method of detection to use.

Parameter properties

Type:ApplicationDetectionMethod
Default value:None
Accepted values:None, Msi, Script, DeploymentType
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

-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

-InputObject

Specify a configuration item object for an application deployment type. To get this object, use Get-CMConfigurationItem.

Parameter properties

Type:IResultObject
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-IsPerUserInstallation

Set this parameter to $true to specify that it's installed per user.

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

When you set DetectionOption to Msi, use this parameter to specify the path to the Windows Installer file.

Parameter properties

Type:String
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

-PassThru

Returns an object representing the item with which you're working. By default, this cmdlet may not generate any output.

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

-ScriptFile

When you set DetectionOption to Script, use this parameter to specify the path to the script. Use this parameter with ScriptLanguage.

Parameter properties

Type:String
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

-ScriptLanguage

When you set DetectionOption to Script, use this parameter to specify the language of the script. Use this parameter with ScriptFile and ScriptText.

Parameter properties

Type:ScriptingLanguage
Default value:None
Accepted values:PowerShell, VBScript, JScript
Supports wildcards:False
DontShow:False
Aliases:ScriptType

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ScriptText

When you set DetectionOption to Script, use this parameter to specify the text of the script. Use this parameter with ScriptLanguage.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:ScriptContent

Parameter sets

(All)
Position:Named
Mandatory:False
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

Microsoft.ConfigurationManagement.ManagementProvider.IResultObject

Outputs

System.Object