Menu
CCMEXEC.COM – Enterprise Mobility
  • Home
  • General
  • Configuration Manager
  • Windows 10
  • Intune
  • GitHub
  • Windows 11
  • About the author
CCMEXEC.COM – Enterprise Mobility

Automatically distribute packages to DP in ConfigMgr

Posted on March 27, 2017March 17, 2021 by Jörgen Nilsson

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://github.com/Ccmexec/MEMCM-OSD-Scripts/blob/master/AutoDistributePackage.ps1

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.

  • Configuration Manager
  • Powershell
  • 6 thoughts on “Automatically distribute packages to DP in ConfigMgr”

    1. Ram Lan says:
      January 9, 2018 at 3:35 pm

      You are amazing. The script works perfectly. I don’t have to distribute and one less thing to worry.

      Thanks

      Ram

      Reply
    2. David says:
      March 16, 2021 at 11:09 pm

      Hi,
      This looks really interesting.
      As Microsoft have retired https://gallery.technet.microsoft.com, is it possible for you to upload the script somewhere else please?
      Regards

      Reply
    3. David says:
      March 16, 2021 at 11:09 pm

      Hi,
      This looks really interesting and would solve a lot of problems I have got.
      As Microsoft have retired https://gallery.technet.microsoft.com, is it possible for you to upload the script somewhere else please.
      Regards

      Reply
      1. Jörgen Nilsson says:
        March 17, 2021 at 8:55 am

        Hi, thanks for the heads-up, added it to Github and updated the post.
        Regards,
        Jörgen

        Reply
    4. Jayson Allen says:
      March 18, 2021 at 3:01 am

      Can you explain the argument %msgis02 in reference to the PowerShell script?

      Reply
      1. Jörgen Nilsson says:
        April 1, 2021 at 5:15 pm

        Hi,
        I think i describe it in the post, it contians the messageID created then a new package is created.

        Regards,
        Jörgen

        Reply

    Leave a Reply Cancel reply

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

    This site uses Akismet to reduce spam. Learn how your comment data is processed.

    My name is Jörgen Nilsson and I work as a Senior Consultant at Onevinn in Malmö, Sweden. This is my blog where I will share tips and stuff for my own and everyone elses use on Enterprise Mobility and Windows related topics.
    All code is provided "AS-IS" with no warranties.

    Tweets by ccmexec

    Recent Posts

    • Windows Servicing, Personal Teams and Success.cmd
    • Windows MDM Security Baseline – Settings Catalog
    • Configuring MS Edge Security Baseline v107 using Settings Catalog
    • Configuring Desktop App Installer using CSP and script?!
    • Customizing Taskbar and Start in Windows 11 22h2 with PowerShell

    ©2023 CCMEXEC.COM – Enterprise Mobility | WordPress Theme by Superb Themes
    This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.Accept Reject Read More
    Privacy & Cookies Policy

    Privacy Overview

    This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
    Necessary
    Always Enabled
    Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
    Non-necessary
    Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
    SAVE & ACCEPT