SCCM Configmgr 2012 Powershell Script: Redistribute Multiple Packages to single Distribution Point

In my Previous blog,I posted script On How to Refresh/Redistribute One package on List of Distribution Points http://eskonr.com/2013/09/sccm-configmgr-powershell-script-refresh-package-on-multiple-distribution-points/

This post talks about how to Refresh / Redistribute list of packages to Single distribution Point.

import-module F:\sccm\AdminConsole\bin\ConfigurationManager.psd1
#Change the site Code
$SiteCode = "P01"
#provide the path list of packages to be Refreshed
$packages =GC "C:\scripts\pkglist.txt"
foreach ($package in $packages)
{
#Provide the DP server Name to be refreshed ON
$Server = "CM12DP01"  #host name is enough,no FQDN is required
$pkgs = Get-WmiObject -Namespace "root\SMS\Site_$($SiteCode)" -Query "Select * From SMS_DistributionPoint WHERE PackageID='$Package' and serverNALPath like '%$Server%'"
foreach ($pkg in $pkgs)
{
$pkg.RefreshNow = $true
$pkg.Put()
# "Pkg:" + $package + " "+ "Refreshed On" + " "+ "Server:" +$server | Out-File -FilePath C:\Scripts\server-refresh-results.txt -Append
}
}

For troubleshooting,monitor distmgr.log,sender.log(for primary or secondary), pkgxfermgr.log (for Remote Distribution Points).

To get the package compliance status on all the Distribution Points ,refer SSRS SQL code http://eskonr.com/2013/09/sccm-configmgr-2012-ssrs-reportstatus-of-distribution-points-with-its-package-compliance-status/

Leave a Reply