Add-CMScriptDeploymentType fails if both -ProductCode and -AddDetectionClause are specified
We recently upgraded from ConfigMgr 1706 to 1806. I'm finding that when running the Add-CMScriptDeploymentType cmdlet, it fails with an AmbiguousParameterSet when both ProductCode and AddDetectionClause are specified (the application I'm adding needs both an MSI product code and a registry key detection). This wasn't happening before and appears to be a bug, as the parameter set I'm trying to use specifies the ProductCode as mandatory with the AddDetectionClause as optional (the parameter set I'm trying to use has ProductCode, DeploymentTypeName, InstallCommand and InputObject as the only mandatory parameters, according to the help).


In 1802, we fixed some issues around being able to specify invalid combinations of parameters for new deployment types. This may have changed the behavior you were relying on before.
You can work around this by using New-CMDetectionClauseWindowsInstaller to create a product code detection clause along with a registry detection clause. This should align with the UI workflow as well.
If this is not working as expected, please let us know and file a bug by sending us a frown through the console.