I wrote a handy little VBscript a couple of years ago that can be triggered by a Status Filter Rule to automatically distribute packages as soon as they are created to a Distribution Point. When upgrading to MDT 20213 Update 1 I missed this so I re-wrote it in Powershell. The script is triggered by a Status Filter Rule and then distributes the content to the DP group that is configured in the Powershell script. I am lazy I know 😉
Below is the script, change the $DPgroup variable to the name of your DP group.
It can also be configured with the $CopyToShare variable to configure the package to be available on the package share if that is used. I used it in some environments to speed up OS deployment and use the “Access content directly” option for the Task Sequence when bandwidth is no issue. Save the script in a folder on the Primary Site server.
$DPgroup = "All DP"
$CopyToShare = $False
import-module $env:SMS_ADMIN_UI_PATH.Replace("bin\i386","bin\ConfigurationManager.psd1") -force
[String]$SiteCode = $(Get-WMIObject -ComputerName “$ENV:COMPUTERNAME” -Namespace “root\SMS” -Class “SMS_ProviderLocation”).SiteCode
new-psdrive -Name $SiteCode -PSProvider “AdminUI.PS.Provider\CMSite” -Root “$ENV:COMPUTERNAME” -Description “SCCM Primary Site”
# Configure the package to be availble on DP Share
Set-CMPackage -Id $PackageID -CopyToPackageShareOnDistributionPoints $True -ErrorAction SilentlyContinue
# Add to distributionpoint group
Start-CMContentDistribution –PackageID $PackageID –DistributionPointGroupName $DPgroup
The Status filter rule we need to create will look like this, trigger on Message ID: 30000
For the Actions to run, the following command line needs to be used like shown below.
C:\Windows\System32\WindowsPowerShell\v1.0\Powershell.exe -NoProfile -ExecutionPolicy ByPass -File E:\Scripts\Addtodp.ps1 “%msgis02”
The variable %msgis02% will be used to pass the package ID to the script from the Status Message.
Then you are all done, no more forgetting to add a package to a DP anymore.