Close Menu
    Facebook X (Twitter) Instagram
    Saturday, October 11
    X (Twitter) LinkedIn Reddit RSS
    All about Endpoint Management
    • Home
    All about Endpoint Management
    Home»CM2012»SCCM Configmgr Powershell Script Redistribute package on Multiple Distribution Points

    SCCM Configmgr Powershell Script Redistribute package on Multiple Distribution Points

    Eswar KonetiBy Eswar KonetiSeptember 13, 9:39 am1 Min Read CM2012 7,114 Views
    Share
    Facebook Twitter LinkedIn Reddit

    Powershell Scripting made things lot more easier in Configuration Manager 2012.You can automate console operations by using Windows PowerShell cmdlets.For list of Configmgr SP1 cmdlets,refer http://technet.microsoft.com/en-us/library/jj821831(v=sc.10).aspx

    Manually Refresh of the Distribution Points for a specific package in Configmgr 2012 is not easy as it was in CM07.

    Started using the Powershell script for simple tasks such as Redistribute,updating,adding Distribution points.

    Use the below script to refresh failed package on Multiple Distribution Points.

     

    import-module F:\sccm\AdminConsole\bin\ConfigurationManager.psd1
    $SiteCode = "ESK"
    $DPserver =GC "C:\Script\Servers.txt"
    foreach ($Server in $DPserver)
    {
    $PackageID = "ESK00001"
    $distpoints = Get-WmiObject -Namespace "root\SMS\Site_$($SiteCode)" -Query "Select * From SMS_DistributionPoint WHERE PackageID='$PackageID' and serverNALPath like '%$Server%'"
    foreach ($dp in $distpoints)
    {
    $dp.RefreshNow = $true
    $dp.Put()
    "Pkg:" + $PackageID + " "+ "Refreshed On" + " "+ "Server:" +$server | Out-File -FilePath C:\Script\refresh-results.txt -Append
    }
    }

    Monitor distmgr.log(if the package is refreshed or not),sender.log on the primary site (if your DP is secondary),pkgXfermgr.log (If your DP is remote DP) for any errors.

    Note:Replace the Quotes when you copy the Code.

    You can also download the script from technet gallary here

    More Scripts coming on the way 😉

    configmgr Distribution Point Powershell PowerShell Script Refresh Package Refresh Package on List of Distribution Points SCCM
    Share. Twitter LinkedIn Email Facebook Reddit

    Related Posts

    Export Microsoft Entra ID User Authentication Methods to CSV using PowerShell & Microsoft Graph API

    August 13, 2:08 pm

    SCCM SQL Report – Compare Installed Apps on TWO Different Computers

    July 13, 10:35 am

    Exporting Intune Win32 Apps with All Properties Using PowerShell and Microsoft Graph

    June 30, 7:01 pm

    5 Comments

    1. nawaz.kazi on October 3, 2014 3:29 PM

      working Good. I am speechless how do i appreciate you.

      Reply
    2. Thanuja on May 6, 2014 12:05 AM

      Hi Eswar,

      Im trying to update content for the application having multiple Deployment types and tried with the following script:

      Import-Module "C:\Program Files (x86)\Microsoft Configuration Manager Console\AdminConsole\bin\ConfigurationManager.psd1"

      $ApplicationName =Read-host("mention the app name")
      #Input parameters
      $sitecode = "Sitecode"
      CD $sitecode":"
      $ApplicationCI=(Get-CMApplication -Name $ApplicationName).CI_ID

      If ($ApplicationCI -eq $Null)
      {
      Write-host "sorry"
      }

      Else
      {

      $dptypes=get-cmdeploymenttype -ApplicationName $ApplicationName
      $x= $dptypes.LocalizedDisplayName
      foreach ($y in $x)
      {
      Update-CMDistributionPoint -ApplicationName $ApplicationName -DeploymentTypeName $y }
      }

      The above script end with error in deployment type check ,Unfortunately it is updating the first deployment type of the application and deleting the remaining deployment types.. 🙁

      I tried passing the deloyent type name directly, it is taking correctly, but when i use foreach loop and get the inputs as array, it is ending up with error.
      Can you provide your suggestions on this ?

      Reply
      • Eswar Koneti on May 15, 2014 12:48 PM

        will check and update you on this.

        Reply
    3. Prem Saagar S on December 13, 2013 10:47 AM

      i tried the above PS to redistribute an application with its package id to multiple Distribution points i got the error

      Exception calling "Put" with "0" argument(s): "Generic failure "
      At line:14 char:13
      + $dp.Put()
      + ~~~~~~~~~
      + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
      + FullyQualifiedErrorId : DotNetMethodException

      how to get this done?

      Reply
      • Eswar Koneti on December 27, 2013 11:32 AM

        seems like put command is not recognised,did you import the cm module and changed the sitecode ? also i would request to change the quotes ('")

        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.