Configuration Manager 2012 and package deployment

Hi there,

I have several things which i’m struggling with.
I’m trying to schedule a package program deployment for a specific device collection.

1st thing : probably because i’m using a too old version of SCCM, the cmdlet New-CMPackageDeployment doesn’t exit
I’m able to create a package and package programs as well but this cmdlet which i found in several docs is not available in my module
So i started to look towards the Start-CMPackageDeployment cmdlet which seems to operate the same way (if someone can confirm)

2nd thing : i understood (but i hope i’m not wrong) that when the question comes about scheduling something in SCCM, you need to create a schedule token object via the New-CMSchedule cmdlet and then, use this object within the Start-CMPackageDeployment
And this is where the crap starts
I’m absolutely not able to achieve something viable.

For reference, i put my code below and if someone can provide me with some help, that would be highly appreciated (of course, an answer such as “upgrade to a newer version of SCCM” is NOT an answer :smiley: )

Thanks

$CollectionName = "TargetCollection Test #1"
$ProgramName = "Dummy Prg"
$packageName = "Dummy Package"
$deployPurpose = "Required"
$RerunBehavior = "RerunIfFailedPreviousAttempt"
$useUTC = $false
$DeploymentSchedule = New-CMSchedule -Start $deploymentStartTime -Nonrecurring

Start-CMPackageDeployment -collectionName $CollectionName -StandardProgramName $deviceProgramName -packageName $packageName -schedule $DeploymentSchedule -deployPurpose $deployPurpose -RerunBehavior $RerunBehavior -useUTC $useUTC

Hi there and welcome!

I want to set some expectations before responding. This is a PS forum and we’re here to help people where we can. Ultimately you are responsible for your systems at work. Many of us that respond may not SCCM experts (though some may have experience and they can provide more salient advice). On that note, an acceptable answer from this forum (or a user who responds) perspective could be to update. I know that doesn’t solve your issue if you can’t update, but sometimes, things need updated :slight_smile: . If you’re running an old/out of date version of SCCM that isn’t supported, you really should investigate that.

First Item:

You’re probably right. You’d need to know what version of the module you are running and simply see if that command existed (if there’s historical knowledge online about it). If you have the module imported and it’s not exposed, then the command isn’t available. I am not sure if you can even update module version without updating SCCM as a whole, as it sorta comes with it right? In any case I think you probably right, but that probably means you want to look into updating SCCM ASAP as there might be other concerns there!

Second Item:
What error are you getting? What ‘crap starts’? What do you mean by not achieving something ‘viable’? It’s best to assume we know nothing and fully explain what your expected outcome/result to be, as well as provide full details of what issues you are having. One very quick thing to point out, your $ProgramName variable is not used, and $deviceProgramName is likely null, at least based on your code provided. Possible these are supposed to align?

Thx for your reply dotnVo

I do agree on many statements you wrote. My point about “upgrade” is not an answer is that the work i’m doing right now is just to save me time, the client i’m wokring for has no time, budget whatsoever to upgrade to another version and he perfectly understands that running an outdated version of a software might cost him later more than what he expects to save right now (you know… all the clients are the same :smiley: )

Anyway, i think i solved my issue but nevertheless, i’m gonna share and answer just because you also spend some time to reply my post.

So 1st of all, the version of Configuration Manager i’m using is 2012 R2 SP1 and the version of the ConfigurationManager module that it comes with is 5.0.8231.1004
Just like you, i’m pretty sure the only way to have a more recent version of that module would be to upgrade SCCM. That being said, the module also comes with the SCCM Admin Client. So, maybe i’ll try to check if a newer version of the Admin console might work with an older version of the SCCM server itself.

Anyway, as i said, when i import the module and check the avaiable cmdlet for that module (Get-Command -Module ConfigurationManager), clearly the cmdlet New-CMPackageDeployment doesn’t exist.
Funny thing is that New-CMPackage does exist because i’ve been able to create my package with this.

So i started to look around the cmdlet “Start-CMPackageDeployment” which seems to operate in the same direction. My goal being to deploy a program from a package to a specific collection group target at a specific time. Nothing fancy.

You’re right, the code i copied above was not accurate and i missed the latest test i performed with the correct variables so that none of them are considered as null.

as i said, i found the bottom line why my command failed and it was that i missed the parameter “-StandardProgram”, pretty much everything else was in place. i can’t recall the error message i had at that time but it was a generic PowerShell error, something like “unable to process the cmdlet” (as it was written in french i’m not even sure how to translate this)

So in the end, deployment was created successfuly, i have a very very few parameters that seems not possible to tweak via the version of the module i’m using but i’m pretty pleased with the final result anyway

So here’s the final code :

$CollectionName = "TargetCollection Test #1"
$ProgramName = "Dummy Prg"
$packageName = "Dummy Package"
$deploymentStartTime = get-date 08/02/2024 -hour 16 -Minute 30 -Second 00
$deployPurpose = "Required"
$useUTC = $false
$RerunBehavior = "AlwaysRerunProgram"
$RunPolicy = "RunProgramFromDistributionPoint"

$DeploymentSchedule = New-CMSchedule -Start $deploymentStartTime -Nonrecurring
Start-CMPackageDeployment -CollectionName $CollectionName -PackageName $packageName -StandardProgram -StandardProgramName $ProgramName -DeployPurpose $deployPurpose -Schedule $DeploymentSchedule -Comment "Generated via PowerShell script" -SlowNetworkOption $RunPolicy -FastNetworkOption $RunPolicy -RerunBehavior $RerunBehavior -AllowSharedContent $false

Hope that it could also help people in the same situation.
Cheers.

Good luck! I remember doing something similar in SCCM 2012 R2 for Windows Update deployments because creating the baselines and deployments was so slow and painful. I finally got it to work with New-SCCMSUGDeployment and Create-SUGDeployment, but it wasn’t pretty.