Remove all failed packages from the Distribution Point

Remove all failed packages from the Distribution Point

Removing a package from a Distribution Point through the console is pretty easy, you would just go in the package properties and under content location you can select the Distribution Point and Remove the package from it. What if you want to start clean and remove all failed packages from the Distribution Point?

The answer to that is: you can’t through the SCCM Console, unless you have just a few or unless you’d like to spend a few weeks cleaning that mess up 🙂

I put together a quick powershell script that will remove all failed packages from the distribution point/points. The script will firstly gather all packages in a Failed Distribution state, and then it’ll go through each one of them and delete it from the DP that shows it as failed.

That’s it. Just pay attention when running this as it’ll start removing one after the other. I’m not assuming any responsibility in case you brake your server. You may change this script in many ways, for instance when you want to remove all failed content from just one distribution point. The script above will remove ALL packages from ALL distribution points that show as Failed. So, just the ones showing in red in the screenshot below.


The script should work on both SCCM 2007 and 2012/2012 R2.


comments user

Try this for the ServerNALPath:

$ServerNalPath = $ServerNALPath -replace “([\[])”,'[$1]’ -replace “(\\)”,’\$1′

    comments user

    Thank you!

comments user

Really nice. Had an old package trying to replicate and it took care of the problem quick.

comments user

Very nice. I added a variable to only do it on one DP on line 5
“AND ServerNALPath like ‘%$DPCLEAN%'”
Also the trim $dpFQDN = $dpFQDN[0] changed to $dpFQDN = $dpFQDN[-1] for some reason it kept removing the first letter.

Leave a Reply

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

IT Droplets

IT Droplets