Install SCCM Distribution Point Using PowerShell Script

In this post, I will show you how to install SCCM distribution point using PowerShell script. I have been working on this script for since a couple of days. Finally, I have got it working and excited to share with everyone.

You can use the PowerShell script to install the ConfigMgr distribution point on a remote Windows Server. This script works well on all the latest versions of Configuration Manager current branch. You can also include this script in the task sequence and install the DP soon after you image the remote machine.

Creating a distribution point in SCCM is not a tough task, you could that using a wizard. However, using a PowerShell script, this can be done more easily and quietly. Furthermore, this script allows you to enable PXE, specify the password and also enable Multicast on Distribution Point.

When attempted to install SCCM distribution point using PowerShell script, the latest version of current branch showed the below warning when I ran the old script. I have updated the script, and you shouldn’t see the below warning message any more.

WARNING: Use of Set-CMDistributionPoint cmdlet for creating or modifying multicast service point roles has been deprecated and may be removed in a future release. Set-CMMulticastServicePoint cmdlet should be used instead.

Install SCCM Distribution Point Using PowerShell Script

We’ll now look at the steps to install SCCM distribution point using PowerShell script. The below script allows you to install SCCM distribution point using PowerShell cmdlets. Also ensure you keep your Configuration Manager cmdlet library updated. While this is not a complex script, lets me highlight the important commands.

Most noteworthy, before you use this script you need to specify the values for the below :-

  • $SiteCode – Provide the site code (3 alphanumeric characters).
  • $DistributionPoint – Specify the server FQDN where you want to install DP role.
  • $PXEpass – Specify PXE password.
.SYNOPSIS
Install Distribution Point role using PowerShell Script

.DESCRIPTION 
This scripts lets you install the Distribution Point role on a server, Enable PXE, PXE password and Multicast options.

.PARAMETER DistributionPoint
This the server name where you would be installing Distribution Point role.

.PARAMETER SiteCode
This is the 3 letter site code.

.PARAMETER PXEpass
This is the PXE password.

.NOTES
Version: 2.0
Published Date: 08-December-2016
Updated Date: 07-May-2023
Author: Prajwal Desai
Website: https://www.prajwaldesai.com
Post Link: https://www.prajwaldesai.com/install-sccm-distribution-point-using-powershell-script/
#>

#Load the Configuration Manager Module
import-module ($Env:SMS_ADMIN_UI_PATH.Substring(0,$Env:SMS_ADMIN_UI_PATH.Length-5) + '\ConfigurationManager.psd1')
$Drive = Get-PSDrive -PSProvider CMSite
CD "$($Drive):"

#Site Code and Distribution Point Server Information
$SiteCode = 'IND'
$DistributionPoint = 'CORPSCCM.PRAJWAL.LOCAL'

#Install Site System Server
New-CMSiteSystemServer -ServerName $DistributionPoint -SiteCode $SiteCode

#Optional - Install SCCM IIS Base components
#dism.exe /online /norestart /enable-feature /ignorecheck /featurename:"IIS-WebServerRole" /featurename:"IIS-WebServer" /featurename:"IIS-CommonHttpFeatures" /featurename:"IIS-StaticContent" /featurename:"IIS-DefaultDocument" /featurename:"IIS-DirectoryBrowsing" /featurename:"IIS-HttpErrors" /featurename:"IIS-HttpRedirect" /featurename:"IIS-WebServerManagementTools" /featurename:"IIS-IIS6ManagementCompatibility"  /featurename:"IIS-Metabase" /featurename:"IIS-WindowsAuthentication"  /featurename:"IIS-WMICompatibility"  /featurename:"IIS-ISAPIExtensions" /featurename:"IIS-ManagementScriptingTools" /featurename:"MSRDC-Infrastructure" /featurename:"IIS-ManagementService"

#Install Distribution Point Role
write-host "The Distribution Point Role is being Installed on $DistributionPoint"
Add-CMDistributionPoint -CertificateExpirationTimeUtc "October 10, 2025 10:10:00 PM" -SiteCode $SiteCode -SiteSystemServerName $DistributionPoint -MinimumFreeSpaceMB 1024 -ClientConnectionType 'Intranet' -PrimaryContentLibraryLocation Automatic -PrimaryPackageShareLocation Automatic -SecondaryContentLibraryLocation Automatic -SecondaryPackageShareLocation Automatic

#Define PXE Password
$PXEpass = convertto-securestring -string "password" -asplaintext -force

#Enable PXE, Unknown Computer Support, Client Communication Method
Set-CMDistributionPoint -SiteSystemServerName $DistributionPoint -SiteCode $SiteCode -EnablePxe $True -PXEpassword $PXEpass -PxeServerResponseDelaySeconds 0 -AllowPxeResponse $True -EnableUnknownComputerSupport $True -UserDeviceAffinity "AllowWithAutomaticApproval" -EnableContentValidation $True -ClientCommunicationType HTTP

#Enable Multicast Feature
Add-CMMulticastServicePoint -SiteSystemServerName $DistributionPoint -SiteCode $SiteCode

Script Explanation

Firstly, we import the Configuration Manager module. To import the Configuration Manager module, you will have to specify the path to the Configuration Manager Module.  This is done using the import-module command.

In the second step, we install site system server. Before you install distribution point role, this step is required. To add a new site system server, we use New-CMSiteSystemServer command.

The next step is optional. The command installs the IIS base components required for DP using dism method. Since this is optional, you could choose to skip this because it’s done by SCCM. Here is a post that shows the installation of IIS components for SCCM.

In the next step, we install the DP role using Add-CMDistributionPoint cmdlet. This cmdlet creates a distribution point on a site system server. However, this cmdlet has got plenty of parameters that we can supply. So, the parameters that we specify with this cmdlet are:-

  • CertificateExpirationTimeUtc – Date and time when the certificate expires.
  • ClientConnectionType – Internet / InternetandIntranet / Intranet.
  • PrimaryContentLibraryLocation, PrimaryPackageShareLocation – Set to Automatic.
  • SecondaryContentLibraryLocation, SecondaryPackageShareLocation – Set to Automatic.
  • MinimumFreeSpaceMB – Free size in MB on a drive before SCCM selects a different drive and continues the copy process to that drive.

In the next step, we specify the PXE password. We use convertto-secure string to convert plain text to secure strings rather leaving it plain. Furthermore, we enable PXE, Unknown Computer Support, Client Communication Method using Set-CMDistributionPoint cmdlet.

In the last step, using the Add-CMMulticastServicePoint cmdlet, we enable multicast feature on distribution point.

Finally, to run this script, launch the Windows PowerShell ISE. Click on File > Open > browse and locate the script. Also specify the site code, DP, PXE pass, and you are good to install DP.

Install SCCM Distribution Point Using PowerShell Script
Install SCCM Distribution Point Using PowerShell Script

I hope I have made it easier to install SCCM distribution point using PowerShell script. In case you have any questions, you can

14 Comments

  1. Avatar photo Cliff Hughes says:

    Hi, what about doing this during a newly deployed Server OS image using a task sequence, how could I use this in a task sequence step to add the role at the end, I have a task sequence that builds the server and installs and configures IIS using some roles and features steps from MDT integration, I just to add the DP role to the newly built system. This seems like a possible good start to do that

  2. Avatar photo Tomas Kozina says:

    Hi, would it be possible to update the script to work with latest SCCM 1902? Thanks for information.

    1. Avatar photo Cliff Hughes says:

      Like Sven posted below, this code no longer works without changes. The “New-CMSiteSystemServer command now uses the parameter -SiteSystemServerName instead of -ServerName I used find and replace to fix this using this info, and then after adding my site code and FQDN of my server it worked fine in SCCM 1906, ran from the PowerShell ISE Console launched from the SCCM Admin console. I am still trying to get it to work from the Run Scripts feature. Not sure on that.

  3. This code no longer works without changes. The “New-CMSiteSystemServer command now uses the parameter -SiteSystemServerName instead of -ServerName
    Tested with 1702…

  4. Can this be used to install a pull distribution point?

  5. Hi Prajwal,

    If i have 2 location with different domain,and i have SCCM in 1 location. so can i use my sccm to deploy patch to other location.If yes then how?

  6. Avatar photo Bryan Gonzalez says:

    Prajwal, semantics point: you could tidy up your optional dism command with Add-WindowsFeature cmdlet. (May or may not need to Import-Module ServerManager) (In my example I have all the prereqs for all the roles, but you need only pick out the ones necessary for a DP role) (Also Add-WindowsFeature supports -Computer parameter, so you could run your whole script from an admin workstation) (Additional benefit, you don’t have to specify packages for dependencies, they are installed automatically, this list is specifically for 1511 reqs but should work for all)

    Add-WindowsFeature -Name NET-Framework-Features,NET-Framework-Core,BITS,BITS-IIS-Ext,BITS-Compact-Server,Web-Server,Web-WebServer,Web-Common-Http,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-Static-Content,Web-Http-Redirect,Web-App-Dev,Web-Net-Ext,Web-Net-Ext45,Web-ASP,Web-Asp-Net,Web-Asp-Net45,Web-CGI,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Health,Web-Http-Logging,Web-Custom-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Http-Tracing,Web-Performance,Web-Stat-Compression,Web-Security,Web-Filtering,Web-Basic-Auth,Web-IP-Security,Web-Url-Auth,Web-Windows-Auth,Web-Mgmt-Tools,Web-Mgmt-Console,Web-Mgmt-Compat,Web-Metabase,Web-Lgcy-Mgmt-Console,Web-Lgcy-Scripting,Web-WMI,Web-Scripting-Tools,Web-Mgmt-Service,RDC

    with an optional -Verbose and/or -IncludeManagementTools

  7. Splendid, thanks you very much for your works.
    But, i have a problem whit your script, on line 27.
    I don’t find C: ?

    1. There is nothing called C: that is used in the script. Are you referring to CD “$($Drive):” ??

Leave a Reply

Your email address will not be published. Required fields are marked *