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.
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.
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
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.
2. Find the name(s) of your distribution point group.
3. Open the script and let it know the name(s) of your distribution point group.
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.
2. Press “Create” to open the Rules Wizard.
3. Give the new Rule a Name (Auto Distribute new Package) and make Message ID 30000 the trigger. Press Next
4. Specify the Action for the new Rule = Run the script with Powershell. Press Next when done.
Program: “C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe” -executionpolicy bypass -file “C:\Scripts\AutoDistributePackages.ps1” %msgis02
5. Check the Summary and press Next.
6. Close wizard
7 You should now have a new Status Filter Rule. Press OK to close the Window.
Next time you create a package, driver package or add an OS image, Distribution will be automatically handled for you.
-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.