SCCM Content Housekeeping


Hi Team, I am looking for a PowerShell script to cleanup SCCM Content from Distribution Point as Well as DP Groups.

Using Remove-CMContentDistribution I am able to clean from DP’s however not able to clean from DP Groups.

Below is the commandline from the script I have used:

Remove-CMContentDistribution -DistributionPointName $DP[0] -ApplicationName $AppList[0].LocalizedDisplayName -Force

Is there a command line/script that can be used specifically to identify the targeted DP’s and DP Group’s for a list of applications and then remove them automatically.

solved 0
Ritesh Aggarwal 2 months 5 Answers 106 views Beginner 0

Answers ( 5 )

  1. Hi try below commands
    Create a CSV file mentioning the application name inside it.

    Also for testing place any 1-2 DP’s in a new distribution point group and name that DP group as ‘All’ or whatever you like and then use below command.

    I think the point missing previously is that DP name and DP group name should be used in same command line.

    $csv = import-csv C:TempCleanupApps.csv
    foreach ($App in $csv.applications) {
    Remove-CMContentDistribution -ApplicationName $APP -DistributionPointName Server1.testlab.local -DistributionPointGroupName All -verbose -force
    Remove-CMContentDistribution -ApplicationName $APP -DistributionPointName Server2.testlab.local -DistributionPointGroupName All -verbose -force
    Remove-CMContentDistribution -ApplicationName $APP -DistributionPointName Server3.testlab.local -DistributionPointGroupName All -verbose -force
    Remove-CMContentDistribution -ApplicationName $APP -DistributionPointName Server4.testlab.local -DistributionPointGroupName All -verbose -force

    Best answer
    • In addition to Ankit’s answer i would like to add few points.

      PowerShell script to cleanup SCCM Content from Distribution Point as Well as DP Groups is what the scope i am considering.

      As far as i understood.
      1. You have Deleted few Packages/Applications in SCCM and now trying to cleanup “Content Library” at DP end to claim space.
      2. You have several contents in distributing state and always staying in the same state.
      3. Any reason for not using content Library cleanup inbuilt tool for DP?
      4. If you could be a little bit more specific what we are trying to do then it will be helpful.

  2. Hi,
    Follow the link below by MS which shows the syntax for DP group also in the same command line which you are using.

    Have you tried below command?

    Remove-CMContentDistribution -DistributionPointGroupName $DP[0] -ApplicationName $AppList[0].LocalizedDisplayName -Force

Leave an answer

Sorry, you do not have a permission to answer to this question .