Add-CMCIDetectionMethod
Specify how the client detects an application.
Syntax
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.
Type: | String |
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 |
-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.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DetectionOption
Specify the method of detection to use.
Type: | ApplicationDetectionMethod |
Accepted values: | None, Msi, Script, DeploymentType |
Position: | Named |
Default value: | None |
Required: | True |
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 |
-InputObject
Specify a configuration item object for an application deployment type. To get this object, use Get-CMConfigurationItem.
Type: | IResultObject |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-IsPerUserInstallation
Set this parameter to $true
to specify that it's installed per user.
Type: | Boolean |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-MsiFilePath
When you set DetectionOption to Msi
, use this parameter to specify the path to the Windows Installer file.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-PassThru
Returns an object representing the item with which you're working. By default, this cmdlet may not generate any output.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ScriptFile
When you set DetectionOption to Script
, use this parameter to specify the path to the script. Use this parameter with ScriptLanguage.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | 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.
Type: | ScriptingLanguage |
Aliases: | ScriptType |
Accepted values: | PowerShell, VBScript, JScript |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ScriptText
When you set DetectionOption to Script
, use this parameter to specify the text of the script. Use this parameter with ScriptLanguage.
Type: | String |
Aliases: | ScriptContent |
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
Microsoft.ConfigurationManagement.ManagementProvider.IResultObject
Outputs
System.Object