Add missing InstallationBehaviourType parameter to new DeploymentType cmdlets in SCCM Powershell Cmdlets.
This goes for all new Add/Set-CM*DeploymentType but for my example, I'll refer to Add-CMScriptDeployment.
An example below is my generic Script Deployment Type.
-ApplicationName "$PublicName" `
-DeploymentTypeName "$AppName Client" `
-ContentLocation "$AppLocation" `
-InstallCommand "$InstallStr" `
-UninstallCommand "msiexec /x $MSICode /qn" `
-MaximumRuntimeMins 720 `
-LogonRequirementType WhereOrNotUserLoggedOn `
-UserInteractionMode Hidden `
-ScriptLanguage PowerShell `
When this is run, the DT is created with the Installation Behaviour set to the default value of "Install for system if resource is device; otherwise install for user"
The previous version of this cmdlet - Add-CMDeploymentType had the parameter available to configure this option, but it seems to have been removed from the parameters available in the new cmdlet.
My Current workaround is to call the now deprecated "Set-CMDeploymentType" like the below command shows.
Set-CMDeploymentType -DeploymentTypeName "$AppName Client" -ApplicationName "$PublicName" -MsiOrScriptInstaller -InstallationBehaviorType InstallForSystem
Can we please get the "InstallationBehaviourType" parameter added back to the new Add-DeploymentType cmdlets.
This is fixed in the 1604 release of the Cmdlet library.
Mohamed Elhadidy commented
I've worked a lot on automating things with SCCM SDK and Powershell.
I came across this issue long ago and by studying how configmgr create objects I found the solution (at least in my environment):
This parameter is incorrect (although it's what's showed in Powershell ISE).
The correct parameter is:
Hope this helps.
We had just upgraded to 1511.
These are the commands that work for me now....I'm not sure what wasn't working when I had problems. I appreciate someone from MS reaching out. I know you guys are trying. It's all very complicated. We are getting good value out of these cmdlets by scripting our packaging.
Add-CMMsiDeploymentType -ApplicationName $app.ApplicationName -EstimatedRuntimeMins $using:EstRunTime -MaximumRuntimeMins $using:MaxRunTime -InstallCommand $app.installer -uninstallcommand $app.uninstaller `
-LogonRequirementType $app.logontype -SlowNetworkDeploymentMode Download -ContentFallback -EnableBranchCache `
-InstallationFileLocation $installationfilelocation -UserInteractionMode Hidden `
-DeploymentTypeName $App.ApplicationName -forceforUnknownPublisher -erroraction Stop | Out-Null
get-cmdeploymenttype -ApplicationName $app.ApplicationName -DeploymentTypeName $app.ApplicationName -erroraction Stop | Set-CMDeploymentType -MsiOrScriptInstaller -InstallationBehaviorType InstallForSystem -PersistContentInClientCache $false -erroraction Stop
AdminAdam Meltzer (ConfigMgr Product Team) (Software Engineer, Microsoft Endpoint Configuration Manager) commented
If you're running into bugs or specific feature requests for the cmdlets, please file them on Connect at https://connect.microsoft.com/ConfigurationManagervnext.
I realize it's not quite as convenient to do this as it is to leave feedback here but this ensures that this goes directly into our bug tracking system.
That said, we will look into addressing these feedback items for our next release. Thanks for bringing them to our attention.
@anonymous #1 -- what version of Configuration Manager were you using and what was the command line you used to create the deployment type when it didn't work?
Even worse for me, the deployment types were broken until I used your trick (use set-cmdeploymenttype -InstallationBehaviorType InstallForSystem). I'd get an error in the console when I tried to edit the deploymenttype, and if you continued through the error you'd only get half of the tabs available.
But using this technique, I can create functional deploymenttypes with the add-cmscriptdeploymenttype cmdlet.
Greatly appreciate this web page. Greatly frustrated at MS.
Great Tip. I fell on the same problem :/