none
Start-CMPackageDeployment Still broken?

    Question

  • Hello All,

    I want to create a lot of packages, collections and deployments throug powershell.

    Most of the manipulations work just great.

    the only thing I can't get working is the deployment.

    To trigger a deployment, one should use the Start-CMPackageDeployment cmdlet.
    Unfortunately, this seems broken. I've seen a lot of threads of this cmdlet that was broken in R2 CU1 and that it was fixed in CU2.

    I'm running SP2 CU2 but am still seeing the same error:

    Start-CMPackageDeployment -CollectionName $coll.name -DeviceProgramName "Install" -PackageName $AppName

    Renders the following message:

    Start-CMPackageDeployment : Parameter set cannot be resolved using the specified named parameters.
    At line:1 char:1
    + Start-CMPackageDeployment -CollectionName $coll.name -StandardProgramName "Insta ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Am I missign a required parameter?

    I've checked the technet library and those 3 above referenced parameters should be the only ones which are required.

    Is anybody else also seeing this behaviour?

    Thanks!

    Filip

    Thursday, February 18, 2016 12:35 PM

Answers

  • If you're deploying as a required program (the default) you need to specify -Schedule or -ScheduleEvent. If you're deploying as available, you don't need these but you do need to specify -DeployPurpose Available.

    Here's some examples:

    # Available deployment
    start-cmpackagedeployment -PackageName "test" -ProgramName "testprg" -CollectionName "All Systems" -StandardProgram -DeployPurpose Available

    # Required deployment
    start-cmpackagedeployment -PackageName "test" -ProgramName "testprg" -CollectionName "All Systems" -StandardProgram -ScheduleEvent AsSoonAsPossible

    Thursday, February 18, 2016 7:31 PM

All replies

  • Hello Simon,

    Yes, I'm running the latest version of the cmdlets.

    I specifically updated them to make sure this wasn't causing the problem.

    Thursday, February 18, 2016 1:45 PM
  • Hello All,

    I believe I'm a bit further already.
    I'm now using following cmd line:

    Start-CMPackageDeployment -CollectionName $coll.name -Package $Package -StandardProgram:$true -ProgramName "Install"

    And am getting back following error:

    Start-CMPackageDeployment : Mandatory schedule or events must be set for Required offer type.

    Thursday, February 18, 2016 1:51 PM
  • If you're deploying as a required program (the default) you need to specify -Schedule or -ScheduleEvent. If you're deploying as available, you don't need these but you do need to specify -DeployPurpose Available.

    Here's some examples:

    # Available deployment
    start-cmpackagedeployment -PackageName "test" -ProgramName "testprg" -CollectionName "All Systems" -StandardProgram -DeployPurpose Available

    # Required deployment
    start-cmpackagedeployment -PackageName "test" -ProgramName "testprg" -CollectionName "All Systems" -StandardProgram -ScheduleEvent AsSoonAsPossible

    Thursday, February 18, 2016 7:31 PM
  • More info:

    Start-CMPackageDeployment

    http://www.powershellcenter.com/index.php/powershell-commands/2531-start-cmpackagedeployment

    Note: Microsoft provides third-party contact information to help you find technical support. This contact information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Friday, February 19, 2016 7:55 AM
    Moderator
  • I'm trying to create a script that will prompt the user for a computer name and a date/time object.  It will then create a collection with a direct membership of that one device and make a deployment of a package/program that restarts the system using a shutdown.exe -r program.  I do this manually somehwhat infrequently so I'd like to create a script that will make it a little easier and less error prone.

    So far i'm successful in creating the collection and adding the direct membership, but it's failing with the same error message as the original post. 

    I'm using the following code.  I'm trying the -schedule parameter per the above post, but that doesn't seem to be helping at all. 

    $allowUsersRunIndependently = $false
    $deploymentAvailableTime = $date.AddMinutes(-30)
    $deviceProgramName = "Scheduled Reboot"
    $packageName = "Utility - Scheduled Reboot or Shutdown"
    $deploymentExpireTime = $date.AddMinutes(120)
    $deploymentStartTime = new-cmschedule -start $date -Nonrecurring
    $deployPurpose = 'Required'
    $rerun = $true
    $RerunBehavior = "AlwaysRerunProgram"
    $softwareInstallation = $true
    $systemRestart = $true
    $useUTC = $false
    $useUTCforExpireSchedule = $false

    Start-CMPackageDeployment -collectionName $rebootCollection.Name -DeviceProgram -DeviceProgramName $deviceProgramName -packageName $packageName -standardprogram -schedule $deploymentStarttime -allowUsersRunIndependently $allowUsersRunIndependently -deploymentAvailableTime $deploymentAvailableTime -deploymentExpireTime $deploymentExpireTime -deployPurpose $deployPurpose -rerun $rerun -RerunBehavior $RerunBehavior -softwareInstallation $softwareInstallation -systemRestart $systemRestart -useUTC $useUTC -useUTCforExpireSchedule $useUTCforExpireSchedule

    Monday, May 2, 2016 8:08 PM
  • I submitted this as a bug on the connect site. 

    https://connect.microsoft.com/ConfigurationManagervnext/feedback/details/2667393/start-cmpackagedeployment-still-broken-for-required-deployments

    Wednesday, May 4, 2016 5:26 PM