Close Menu
    Facebook X (Twitter) Instagram
    Sunday, May 18
    X (Twitter) LinkedIn
    All about Endpoint Management
    • Home
    All about Endpoint Management
    Home»CM2012»SCCM Configmgr 2007 Script to delete packages from Assigned DPs

    SCCM Configmgr 2007 Script to delete packages from Assigned DPs

    Eswar KonetiBy Eswar KonetiFebruary 27, 9:22 pm2 Mins Read CM2012 1,275 Views
    Share
    Facebook Twitter LinkedIn Reddit

    Long ago ,written SCCM report to list packages not used for 6 months as part of Package Archival process http://eskonr.com/2012/11/sccm-configmgr-package-archival-process-cleanup-activity/ .This report tells you to take further action to clean or move to Archive folder to wait for some more months before it goes for Deletion.

    What next ? Delete these packages from Assigned DPs to get some disk space ?

    You may find several scripts to do this task on the internet but, i  find this is easy for me to get this activity done.

    Identify list of package which you want to remove ,pipe them to notepad .You can do more customizations if needed.

    ‘Script to delete packages from its assigned Distribution Points.

    strComputer =inputBox("Please Enter the SMS provider OR Site where the packages are created" , "SCCM Server name")
    Set FSO = CreateObject("Scripting.FileSystemObject")
    Set packages=fso.OpenTextFile("C:\PACKAGESTODELETE.txt",1,true)
    Set objoutputfile=fso.OpenTextFile("C:\DP_results.txt",2,true)

    Do While packages.AtEndOfLine <> True
    'read the next line
    package = packages.Readline

    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\SMS\site_CEN")
    if err.number<>0 then
    msgbox "server connection failed"
    wscript.quit
    end if
    Set colItems = objWMIService.ExecQuery("SELECT * FROM SMS_DistributionPoint where packageid='" & Package & "'")
    For Each objItem in colItems
    'Wscript.Echo "ServerNALPath: " & objItem.ServerNALPath
    objoutputfile.WriteLine ( package & vbTab & " will be deleteting from" & VBTAB & objItem.ServerNALPath)

    objitem.Delete_

    If Err.number <> 0 Then

    objoutputfile.WriteLine ( "Failed to delete" & vbTab & package & "from" &  vbTab & objItem.ServerNALPath)
    End If
    Next

    loop

    msgbox "Done"

    Note: Please Replace the quotes.

    configmgr Delete packages from DP Distribution Point delete packages SCCM script VB Script to remove packages from Assigned DP
    Share. Twitter LinkedIn Email Facebook Reddit

    Related Posts

    Optimize Your Intune Workflow with a Powerful Browser Extension

    March 22, 10:39 am

    Migrate Microsoft 365 Updates from SCCM/MECM to Intune for Co-Managed Devices

    February 11, 9:50 pm

    Investigating Co-Management Issues with Windows Endpoints in SCCM/Intune

    October 26, 10:45 pm

    1 Comment

    1. Pingback: 2012 Configmgr Script to delete packages from assigned DPs | sccm road

    Leave a ReplyCancel reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.

    Sign Up

    Get email notifications for new posts.

    Author

    I’m Eswar Koneti ,a tech enthusiast, security advocate, and your guide to Microsoft Intune and Modern Device Management. My goal? To turn complex tech into actionable insights for a streamlined management experience. Let’s navigate this journey together!

    Support

    Awards

    Archives

    © Copyright 2009-2024 Eswar Koneti, All rights reserved.

    Type above and press Enter to search. Press Esc to cancel.