Configmgr 2012 PowerShell script add packages applications Drivers to Distribution Point

In my previous blog post,i discussed about how to compare 2 distribution points to see if they both have any applications mismatch or not.This blog post talks about how to distribute the missing applications to the Distribution Point/s.

I have used basic inbuilt Configmgr PowerShell commands for this activity,to know more about avilable powershell cmdlets in Configmgr,read here

Before you get started with powershell,you need to Get a list of missing applications,packages,drivers,Boot images ,OS images etc using SQL query /other method which you aware,if you would like to use SQL method,refer my previous blog post .

Export the results into CSV file format which will be the input for our script to distribute these applications to Distribution Point/s.

Your csv file format should look like this:



do some excel work to replace the space with comma(,) and save it as filename.csv

output of CSV (if you open with notepad) should look like this :

PackageType,PackageName,ServerNameinputfile CSV file
Package,Powershell scripts,
package,Outlook Signature,
BootImage,Bootimage X64,
Application,Adobe Reader 10.1,
Driver,Dell Optiplex E6420,


Note:You do not need to install excel on the server from ,where you run the is just csv format,works with notepad.

Below powershell script which can be used to add all types of packages like applications,packages,driver packages,boot images and OS images etc.

#Import Module
$CMModulepath=$Env:SMS_ADMIN_UI_PATH.ToString().Substring(0,$Env:SMS_ADMIN_UI_PATH.Length - 5)+"\ConfigurationManager.psd1"
import-module $CMModulepath -force
#Change the site Code --P01
CD P01:

#Change File Location

Import-Csv C:\Users\eswar\Desktop\add-packages.csv |`
ForEach-Object {
$PackageType = $_.PackageType
$PackageName = $_.PackageName
$ServerName = $_.ServerName

#For packages
If($PackageType -eq "Package")
#echo "This is a Package"
start-CMContentDistribution -PackageName  "$PackageName" -DistributionPointName "$ServerName"

#For applications
If($PackageType -eq "Application")
#echo "This is an Application"
start-CMContentDistribution -ApplicationName  "$PackageName" -DistributionPointName "$ServerName"

#For Driverpackages
If($PackageType -eq "Driver")
#echo "This is a Driver"
Start-CMContentDistribution -DriverPackageName  "$PackageName" -DistributionPointName "$ServerName"

 #For BootImages
If($PackageType -eq "BootImage")
#echo "This is a BootImage"
Start-CMContentDistribution -BootImageName  "$packagename" -DistributionPointName "$server"


#For OSImage
If($PackageType -eq "OSImage")
#echo "This is a OSimage"
Start-CMContentDistribution --OperatingSystemImageName  "$packagename" -DistributionPointName "$server"


Download the script from technet Gallary

How to refresh package on multiple DP’s :

11 Responses to "Configmgr 2012 PowerShell script add packages applications Drivers to Distribution Point"

  1. Hi Eswar,
    good job, I have same requirement but wanted to run the script from a different server instead of the same server, could you tell how is it possible.

    1. did you try running the script from different server ? what issues do you have while running ? make sure you have sccm console installed on your remote server from where you are running the script.

    1. where are you stuck at while running the script ? you get the list of missing packages which you would like to add to DP and then run the powershell script.
      changes you required to do are 1)change sitecode 2)file name .you are done.

  2. Hi Eswar,

    Firstly great script and great blog.

    I'm getting the following when trying to run the scrip on my CAS:

    WARNING: There is no collection.

    I'm getting this for each line of my .csv file....Can you shed any light on this?

    1. there is no collection means,the package what you are trying to add is already part of the DP.You can check manually for the specific packages is already added or not .

  3. HI Eswar,

    Thanks for your information, I have a scenario like i need to distribute packages/applications to multiple distribtuions points (say like HQ and Canada are two distribution points groups that needs to be distributed )and that should happend based on timings as well.Can we make that with excel inputs ?
    Please provide your thoughts on this.

    1. Hi,
      AFAIK,there is no built in task or option to distribution application to distribution point at specific will have to do it manually from console when required.OR Use script to distribute apps/packages to DP's via task scheduler with specific time ,so you have the option to define when the task scheduler runs,it will distribute required apps to DP/DP Group.


Leave a Reply