Delete multiple packages from multiple Distribution Points

Boopathi Subramaniam 3,196 Reputation points
2021-07-30T16:20:56.837+00:00

Hi,
Below powershell script will delete a particular application from list of Distribution Points.

$dps = Get-Content "C:\Users\xy9764\Desktop\sp.txt"
foreach ($dp in $dps)
{
Remove-CMContentDistribution -ApplicationName "Application name" -DistributionPointName "$dp"
}

Help to modify the script so that multiple applications can be deleted from list of Distribution Points

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,364 questions
Microsoft Configuration Manager
0 comments No comments
{count} votes

Accepted answer
  1. AllenLiu-MSFT 40,316 Reputation points Microsoft Vendor
    2021-08-02T06:23:18.53+00:00

    Hi, @Boopathi Subramaniam
    Thank you for posting in Microsoft Q&A forum.

    We can specify a String array for ApplicationName like below:

    $dps = Get-Content "C:\Users\xy9764\Desktop\sp.txt"  
    foreach ($dp in $dps)  
    {  
    Remove-CMContentDistribution -ApplicationName ("Application name 1","Application name 2","Application name 3") -DistributionPointName "$dp"   
    }  
    

    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful