Close Menu
    Facebook X (Twitter) Instagram
    Tuesday, May 20
    X (Twitter) LinkedIn
    All about Endpoint Management
    • Home
    All about Endpoint Management
    Home»CM2012»Configmgr 2012 PowerShell script add packages applications Drivers to Distribution Point

    Configmgr 2012 PowerShell script add packages applications Drivers to Distribution Point

    Eswar KonetiBy Eswar KonetiFebruary 10, 11:02 am2 Mins Read CM2012 5,333 Views
    Share
    Facebook Twitter LinkedIn Reddit

    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  http://eskonr.com/2012/09/sccm-report-compare-packages-on-2-dps/ .

    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:

    image

     

    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,sccmcen.eksonr.com
    package,Outlook Signature,sccmcen.eksonr.com
    BootImage,Bootimage X64,sccmcen.eksonr.com
    Application,Adobe Reader 10.1,sccmdp01.eskonr.com
    Driver,Dell Optiplex E6420,sccmcen.eksonr.com

     

    Note:You do not need to install excel on the server from ,where you run the script.it 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 http://gallery.technet.microsoft.com/Configmgr-2012Add-packages-b47800b9

    How to refresh package on multiple DP’s : http://eskonr.com/2013/09/sccm-configmgr-powershell-script-refresh-package-on-multiple-distribution-points/

    add apps to DP using script add list of packages to DP CM12 Distribution Point PowerShell Script read excel csv powershell SCCM 2012 script to add packages to DP
    Share. Twitter LinkedIn Email Facebook Reddit

    Related Posts

    Migrate Microsoft 365 Updates from SCCM/MECM to Intune for Co-Managed Devices

    February 11, 9:50 pm

    Monitoring Endpoint Security Applications with SCCM ConfigMgr SQL

    October 11, 8:48 pm

    Application Deployment with Hybrid Joined Requirement Rules in Intune

    October 06, 8:59 pm

    11 Comments

    1. Pingback: Masum

    2. Mallikarjun on March 24, 2015 8:31 PM

      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.

      Reply
      • Eswar Koneti on March 25, 2015 7:44 AM

        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.

        Reply
    3. ian on September 11, 2014 2:10 AM

      This looks good but can you show or give exact instructions on how to run this? Or screenshots help too.

      thanks in advanced.

      Reply
      • Eswar Koneti on September 17, 2014 10:19 AM

        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.

        Reply
    4. NBird on May 20, 2014 4:41 PM

      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?

      Reply
      • Eswar Koneti on May 21, 2014 8:22 AM

        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 .

        Reply
    5. Thanuja on May 5, 2014 11:51 PM

      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.

      Reply
      • Eswar Koneti on May 7, 2014 7:10 AM

        Hi,
        AFAIK,there is no built in task or option to distribution application to distribution point at specific time.you 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.

        Reply
    6. Dexter (@DexterPOSH) on March 25, 2014 2:17 PM

      Hi Eswar,
      You have a great Blog ! am a frequent visitor on things related to ConfigMgr

      Suggestion - rather than using multiple if blocks...a switch statement would have been a perfet fit here.

      Regards
      Dex

      Reply
      • admin on March 25, 2014 2:40 PM

        True but will try to update it using case. I find this way to distribute the packages intially and easy 🙂

        Reply

    Leave a ReplyCancel reply

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

    Sign Up

    Get email notifications for new posts.

    Author

    I’m Eswar Koneti ,a tech enthusiast, security advocate, and your guide to Microsoft Intune and Modern Device Management. My goal? To turn complex tech into actionable insights for a streamlined management experience. Let’s navigate this journey together!

    Support

    Awards

    Archives

    © Copyright 2009-2024 Eswar Koneti, All rights reserved.

    Type above and press Enter to search. Press Esc to cancel.

     

    Loading Comments...