Changing the Software Update Package reference of an Automatic Deployment Rule is not possible through the console.
With the following PowerShell script you can change the PackageID through WMI:
#################
# Configuration #
#################
$newPackageID = "PACKAGEID"
$siteCode = "SITECODE"
$serverName = "HOSTNAME"
# All rules matching the following search string will be updated
$searchString = "SUM *"
# See what's going to happen before changing anything
$test = $TRUE
#################
# Code #
#################
$autoDeployments = Get-WmiObject -class "SMS_AutoDeployment" -namespace "root\sms\site_$siteCode" -impersonation 3 -computername $serverName | Where-Object {$_.name -like $searchString}
Write-Host
if ($test)
{
Write-Host "### TESTMODE - Nothing will be changed ###"
Write-Host
}
foreach ($item in $autoDeployments)
{
$item = [wmi]"$($item.__PATH)"
$xmlContentTempl = $item.ContentTemplate
Write-Host "Rule Name:"$item.Name
Write-Host "****************************************************"
Write-Host "PackageID:"$xmlContentTempl.ContentActionXML.PackageID
if ($test)
{
Write-Host "New PackageID would be:"$newPackageID
}
else
{
$xmlContentTempl.ContentActionXML.PackageID = $newPackageID
$item.ContentTemplate = $xmlContentTempl.InnerXml
Write-Host "Saving changes..."
Write-Host
$item.put()
Write-Host "Changes were saved!"
Write-Host "New PackageID:"$xmlContentTempl.ContentActionXML.PackageID
}
Write-Host
}
Principal Security Consultant | MVP at baseVISION AG
I’m a consultant, trainer and architect for modern workplace and enterprise mobility projects with Microsoft Technologies in the past ten years. I love to push and design the modern workplace based on Microsoft 365 for my customers which is the only answer for the current security threats, agile world and the fast-changing business requirements of my customers. Important for me is to simplify and automate the operational processes, because there are the highest costs.
Latest posts by Thomas Kurth (see all)
- Microsoft Sentinel ASIM Parser demystified - March 31, 2024
- Enhancing Network Security Insights with IDS/IPS of Ubiquiti Dream Machine Pro and Microsoft Sentinel - March 10, 2024
- Ubiquiti Dream Machine Pro Logs to Microsoft Sentinel - February 6, 2024



2 Comments
AFisher · December 22, 2016 at 17:12
this is not, but the PackageID Object seems to not exist. I have attempted to just pull that info and its just not there. When look at the SMS_AutoDeployment class no PacakageID is listed.. can you help me with what I am missing?
Thomas Kurth · December 22, 2016 at 18:09
Which Version of ConfigMgr are you using? Then I can try to reproduce the Problem.