Automatically distribute packages to DP in ConfigMgr

I wrote a blog post a while ago where I used a vbscript that will distribute the content of newly added package and check the “copy content in this package to a package share on Distribution Points”. i still use it and it works great… My college Johan Schrewelius re-wrote it to use Powershell instead and it also handles boot images, OS images, driver packages and packages.

If you been working with SCCM for a while you have most probably experienced this? You created a new program package, driver package or perhaps added a new OS image; but you forgot to distribute it.

Failed to run TS

Another possible problem is that your deployment is configured to “Access content directly from a distribution point when needed by the running task sequence” and that you instead forgot to mark the new package to be copied to a package share on distribution points.

Data Access

To make life easier we decided to create a status driven script to automatically handle this.

Every time a new package is added we will get a new status message with ID: 30000

Message ID

This “Message ID” can be used to trigger the execution of a custom script that automates distribution and also, if desired, copies the content to a share, making sure that we from now on don’t have to bother anymore. The script can be downloaded from here: https://gallery.technet.microsoft.com/Script-to-automatically-c069d8b9

CONFIGURE THE SCRIPT

1.Place the script in a “scripts folder” on you Site server.

Powershell Script

2. Find the name(s) of your distribution point group.

DP Group Name

3. Open the script and let it know the name(s) of your distribution point group.

Config Script

If you wish to auto distribute to several groups add them to the list like:

$DPgroups = @(“Group One Name”, ”Group Two Name”)

If you don’t want to copy your packages to a share on DP’s, change $CopyToShare = $false

CREATE STATUS FILTER RULE

1. Right click your “Site” and press “Status Filter Rules” on the context menu.

 

Status Filter Rule

 

2. Press “Create” to open the Rules Wizard.

Status Filter Rules

3. Give the new Rule a Name (Auto Distribute new Package) and make Message ID 30000 the trigger. Press Next

Status Filter Message ID

4. Specify the Action for the new Rule = Run the script with Powershell. Press Next when done.

Run Program

Program: “C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe” -executionpolicy bypass -file “C:\Scripts\AutoDistributePackages.ps1” %msgis02

5. Check the Summary and press Next.

Status filter summary

6. Close wizard

Completion

7 You should now have a new Status Filter Rule. Press OK to close the Window.

Status Filter Rule Done!

8. Done!

Next time you create a package, driver package or add an OS image, Distribution will be automatically handled for you.

Limitations:

-It’s only possible to choose Distribution point groups, if you need DP resolution, feel free to edit the script, or write a dedicated.

-Script must run on a server with the SCCM Admin console installed.

Add a Comment

Your email address will not be published. Required fields are marked *