Remove SCCM Distribution Point Using Powershell Script

In this post we will see how to remove SCCM distribution point using PowerShell script. From past few weeks I have been working on PowerShell a lot. I see it’s very interesting and makes our job easy.

In my previous post I covered the installation of distribution point using powershell script. The script is available for download here. The script is really simple and easy to use. We basically make use of Remove-CMDistributionPoint cmdlet. Therefore using this cmdlet we uninstall distribution point.

In addition to that this cmdlet supports the common parameters such as -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. Most of all ensure you are running SCCM 2012 R2 SP1 and above for this script to work.

I have tested this script on Configuration Manager current branch versions 1511, 1606, 1610. The script to uninstall SCCM distribution point is available for download here.

Remove SCCM Distribution Point Using Powershell Script

This script removes a distribution point by using a site code and site system role. So before you use this script, specify the following values in the script.

$SiteCode – Provide your site code (3 alphanumeric characters).

$DistributionPoint – Specify the server FQDN from where you want to uninstall DP role.

Script Explanation

Remove-CMDistributionPoint – Removes a distribution point.

-Force – Runs the command without asking for user confirmation.

Copy the below script into a notepad and save it as filename.ps1 extension.

Remove Distribution Point role using PowerShell Script

This scripts lets you uninstall SCCM Distribution Point

.PARAMETER DistributionPoint
This is the server name from which you would be uninstalling Distribution Point role.

This is 3 letter site code.

Version: 1.0
Published Date: 10-Dec-2016
Author: Prajwal Desai

#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 = 'WIN2016.PRAJWAL.LOCAL'

#Check if the DP server is alive
Test-Connection -ComputerName $DistributionPoint -quiet

#Remove Distribution Point Role
write-host -ForegroundColor Green "The Distribution Point Role is being uninstalled on $DistributionPoint"
Remove-CMDistributionPoint -Force -SiteCode $SiteCode -SiteSystemServerName $DistributionPoint

Open the script using Powershell ISE. Substitute site code and distribution point values in the script. Save the script and then run the script. If the distribution point server is online, you will see result as True. In the next step you see the distribution point role is uninstalled from the server.

Remove SCCM Distribution Point Using Powershell Script
Remove SCCM Distribution Point Using Powershell Script

If you have any questions regarding this script, mention it in the comments.

Related Posts

Leave a Reply

3 Comment threads
1 Thread replies
Most reacted comment
Hottest comment thread
newest oldest most voted
Maheswara reddy kesu
Maheswara reddy kesu

How to remove site system?

Ahmed Essam
Ahmed Essam

What about if i want to remove about 240 DP

Ayrton Walter
Ayrton Walter

Hello Prajwal!

What if we are trying to discontinue/uninstall permanently offline DPs?
Is the same procedure applicable?


This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More