Serge Chegorian's System Center Blog

Serge Chegorian's System Center Blog

How to add packages to the distribution point using PowerShell

March 26th, 2014

This script should be executed on the primary site server

$sitecode = “XYZ”
$nameSpace = “root\sms\site_XYZ”
$sitename = “XYZ GmbH”
$newBDPName=”servername”

$ListOfPackages = @{“XYZ000001″,”XYZ00002″}

if ($ListOfPackages -ne $null) {
foreach ($packageID in $ListOfPackages) {
$NewDistPointForPackage = @{
PackageID = $packageID;
ServerNALPath = “[`"Display=\\$newBDPName\`"]MSWNET:[`"SMS_SITE=$sitecode`"]\\$newBDPName\”;
SiteCode = $sitecode;
SiteName=$sitename;
SourceSite = $sitecode;
ResourceType = “Windows NT Server”
}
Set-WmiInstance -class SMS_DistributionPoint -arguments $NewDistPointForPackage -namespace $nameSpace
}
}

Serge Chegorian's System Center Blog

Serge Chegorian's System Center Blog