Close Menu
    Facebook X (Twitter) Instagram
    Sunday, October 12
    X (Twitter) LinkedIn Reddit RSS
    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 KonetiNovember 13, 11:15 am1 Min Read CM2012 3,708 Views
    Share
    Facebook Twitter LinkedIn Reddit

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

    I have used basic inbuilt Configmgr powershell commands for this activity,more via here

    Note:Use the package names as input file rather Package ID’s.

    Below powershell script works for applications,packages,driver packages,boot images and OS images.You need to remove the # tag(to uncomment) to distribute specific package type.

    #change the path of psd1
    import-module F:\sccm\AdminConsole\bin\ConfigurationManager.psd1
    #Change the site Code
    cd P01:
    $SiteCode = "P01"
    #provide the path for list of applications to be distributed
    $packages =GC "C:\users\eswar\desktop\pkglist.txt"
    $server='DPname.eskonr.com'
    foreach ($packagename in $packages)
    {
    #for applications
    #Start-CMContentDistribution -ApplicationName  "$packagename" -DistributionPointName "$server"

    #For packages
    #Start-CMContentDistribution -PackageName  "$packagename" -DistributionPointName "$server"

    #For Driverpackage names
    #Start-CMContentDistribution -DriverPackageName  "$packagename" -DistributionPointName "$server"

    #For Bootimages
    #Start-CMContentDistribution -BootImageName  "$packagename" -DistributionPointName "$server"

    #For OSImages
    #Start-CMContentDistribution --OperatingSystemImageName  "$packagename" -DistributionPointName "$server"

    #output results

    "Pkg:" + $packagename + " "+ "distributed to" + " "+ "Server:" +$server | Out-File -FilePath C:\users\eswar\desktop\server-distribute-results.txt -Append
    }

    download the powershell script from technet Gallery

    How to refresh package on many 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 SCCM 2012 script to add packages to DP
    Share. Twitter LinkedIn Email Facebook Reddit

    Related Posts

    SCCM SQL Report – Compare Installed Apps on TWO Different Computers

    July 13, 10:35 am

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

    February 11, 9:50 pm

    How to detect the source of registry key modifications on windows devices – Intune

    November 21, 8:49 pm

    13 Comments

    1. Sumit on January 9, 2015 4:58 PM

      I got it working mate.... Thanks for the wonderful script!!!

      Reply
      • Eswar Koneti on January 9, 2015 8:11 PM

        Great. Did you made any changes to the script or what went wrong with the script?

        Reply
    2. Sumit on January 9, 2015 3:36 PM

      Thanks for the script but unfortunately this one is not working for me.... i have changed the site code, servername & path but still it wont work. Below is the error that i get:

      Start-CMContentDistribution : No object corresponds to the specified parameters.
      At E:\appdp\AddPkg.ps1:6 char:1
      + Start-CMContentDistribution -ApplicationName "$packagename" -DistributionPointN ...
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo : ObjectNotFound: (Microsoft.Confi...ributionCommand:StartContentDistributionCommand) [Sta
      rt-CMContentDistribution], ItemNotFoundException
      + FullyQualifiedErrorId : ItemNotFound,Microsoft.ConfigurationManagement.Cmdlets.Sum.Commands.StartContentDistribu
      tionCommand

      Start-CMContentDistribution : No object corresponds to the specified parameters.
      At E:\appdp\AddPkg.ps1:9 char:1
      + Start-CMContentDistribution -PackageName "$packagename" -DistributionPointName ...
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo : ObjectNotFound: (Microsoft.Confi...ributionCommand:StartContentDistributionCommand) [Sta
      rt-CMContentDistribution], ItemNotFoundException
      + FullyQualifiedErrorId : ItemNotFound,Microsoft.ConfigurationManagement.Cmdlets.Sum.Commands.StartContentDistribu
      tionCommand

      Start-CMContentDistribution : No object corresponds to the specified parameters.
      At E:\appdp\AddPkg.ps1:12 char:1
      + Start-CMContentDistribution -DriverPackageName "$packagename" -DistributionPoin ...
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo : ObjectNotFound: (Microsoft.Confi...ributionCommand:StartContentDistributionCommand) [Sta
      rt-CMContentDistribution], ItemNotFoundException
      + FullyQualifiedErrorId : ItemNotFound,Microsoft.ConfigurationManagement.Cmdlets.Sum.Commands.StartContentDistribu
      tionCommand

      Out-File : Could not find a part of the path 'C:\users\eswar\desktop\server-distribute-results.txt'.
      At E:\appdp\AddPkg.ps1:16 char:75
      + "Pkg:" + $packagename + " "+ "distributed to" + " "+ "Server:" +$server | Out-Fi ...
      + ~~~~~~
      + CategoryInfo : OpenError: (:) [Out-File], DirectoryNotFoundException
      + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand

      Reply
    3. Sameer on November 19, 2013 3:37 AM

      Eswar - Thanks for all your answers so far. We did open a case with premier, and found that this cmdlet is broken. This has been fixed in R2. But as we are going live soon, we can't implement R2. No other options so far..
      Thanks once again for your help. Just wanted to update you and what we found from Microsoft Premier.

      Reply
      • Eswar Koneti on November 27, 2013 7:28 AM

        Thanks Sameer.

        Reply
        • senthamarai kannan on January 5, 2015 8:48 PM

          Hi Eswar,

          I'm trying to use our script to add package to DP, in our Environment we have DP and BDP comes under the same site code, but what i wanted to do is, add multiple listed packages to the only DP list given the text file so that we can avoid BDP, is that any script you have to help us ?
          that would be much appreciated 🙂

          Reply
          • Eswar Koneti on January 5, 2015 10:25 PM

            Try the script Avilable here http://eskonr.com/2014/02/configmgr-2012-updated-powershell-script-add-packages-applications-drivers-to-distribution-point/

            Reply
            • senthamarai kannan on January 6, 2015 12:14 AM

              Thanks for the quick reply eswar, i was using the below script,

              $SiteCode = "QA4"

              #provide the path list of packages to be Refreshed

              $packages =GC "C:\Kannan\pkglist.txt"
              foreach ($package in $packages)
              {
              #Provide the list of DP server Name to be refreshed ON
              Write-Host "Processing Package $package"

              $DPs = GC "C:\Kannan\DPlist.txt"
              foreach ($server in $DPs)
              {
              $pkg = Get-WmiObject -Namespace "root\SMS\Site_$($SiteCode)" -Query "Select * From SMS_DistributionPoint WHERE PackageID='$Package' and serverNALPath like '%$Server%'"

              $pkg.put_

              Write-Host "Package Refreshed On Server : $server"
              "Pkg:" + $package + " "+ "Refreshed On" + " "+ "Server:" +$server | Out-File -FilePath "server-refresh-results.txt" -Append
              }
              }

              Once the script is completed i can the output file stating that all packages are refreshed, but when i checked the log distmgr.log, none of the packages are not added, this is for 2007 environment, Kindly check if any mistakes are changes has to be done please do,

              Reply
              • Eswar Koneti on January 6, 2015 10:35 AM

                script looks good but have no cm07 environment to try this out .may be you can use DPUtility to perform this task ? http://www.myitforum.com/articles/42/view.asp?id=8904

    4. Sameer on November 14, 2013 11:43 PM

      Right now we can upgrade from the console. But we can select only one site out of the 3 we have. We have around 600 secondary sites, which are going to be Remote distribution point. So desperately trying to find a solution as how we can use powershell to upgrade these 2007 secondary sites to 2012 remote DP's..

      Reply
      • Eswar Koneti on November 18, 2013 1:58 PM

        why dont you try this command to upgrade http://technet.microsoft.com/en-us/library/dn151099%28v=sc.20%29.aspx

        Reply
    5. Sameer on November 13, 2013 7:33 PM

      Thanks for the Post. Any powershell for upgrading a secondary site to a Remote Distribution point?

      Reply
      • Eswar Koneti on November 14, 2013 9:02 AM

        you can use the inbuilt powershell commands to upgrade it. http://technet.microsoft.com/en-us/library/jj850100%28v=sc.20%29.aspx
        Upgrading the sec site to Remote DP ? just go ahead and enable DP role on it.isnt that what you need ?

        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-2025 Eswar Koneti, All rights reserved.

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