Create SCCM Distribution Point with Powershell

Hi Sysadmins

You need to create multiple SCCM 2012 Distribution points fast and accurate!

Maybe you decided on upgrading your  environment to SCCM 2012 or your company purchased another organisation. In any case,

The reasonable way will be to use a script, and not use the GUI to do the task over and over.

The preferred scripting environment is Powershell, since it already has many Configuration Manager commandlets that can be helpful.

You do have to work with at least SCCM 2012 sp1 version for the following script to work.

The below Powershell script will read the names of the Distribution points servers from a file. See example for the file Here 

If the server is online, it will install a new DP role on it, and add the DP to a DP group.

You can download the script from Here (Change extension to ps1).

import-module ($Env:SMS_ADMIN_UI_PATH.Substring(0,$Env:SMS_ADMIN_UI_PATH.Length-5) + '\ConfigurationManager.psd1')
$PSD = Get-PSDrive -PSProvider CMSite
CD "$($PSD):"

$DPList = Get-Content D:\Scripts\DPlist.txt
$SiteCode = HQ1 #Change this to your three letters site code.

# Start Installing a new DP
foreach ($D in $DPList)
    { "$D - Testing connection"
    if(Test-Connection -ComputerName $D -Count 1 -Quiet) #Check if the DP server is online.

        { 

    if (Get-CMDistributionPoint -SiteSystemServerName $D) #Check if DP is already installed.
    {"$D DP Already Exists"}
        Else {

        Write-Host -ForegroundColor DarkGreen "Start Installing DP on Server $D"
        New-CMSiteSystemServer -ServerName $D -SiteCode $SiteCode
        Add-CMDistributionPoint -SiteSystemServerName $D -SiteCode $SiteCode -MinimumFreeSpaceMB 5000 -CertificateExpirationTimeUtc "April 16, 2113 05:55:55 PM" -InstallInternetServer
        Start-Sleep -Seconds 360 #Wait for the DP installation process to finish.
        Add-CMDistributionPointToGroup -DistributionPointName $D -DistributionPointGroupName "Branch DPs"
    }

        }
        else {"$D Did not respond"}
            }

I hope this has been helpful for you,

T@mir.H

One thought on “Create SCCM Distribution Point with Powershell”

Leave a Reply