Close Menu
    Facebook X (Twitter) Instagram
    Sunday, October 12
    X (Twitter) LinkedIn Reddit RSS
    All about Endpoint Management
    • Home
    All about Endpoint Management
    Home»ConfigMgr (SCCM)»SCCM 2007 Script to Delete Old PCK files from SMSPKG folder Avoid Disk Space issues

    SCCM 2007 Script to Delete Old PCK files from SMSPKG folder Avoid Disk Space issues

    Eswar KonetiBy Eswar KonetiSeptember 10, 6:37 am3 Mins Read ConfigMgr (SCCM) 2,766 Views
    Share
    Facebook Twitter LinkedIn Reddit

    Did you ever get into disk Space Issues while copying,Decompressing PCK files in Configuration Manager 2007 ? Packages are failed due to not enough disk space ?

    couple of options to get out of it are 1) Add Extra Drives or Increase the Disk on the Drive if you are into VM 2) manage with the existing disk by doing some alteration to it like moving the PCK files or Delete them.

    OR Move to Configuration manager 2012 which no longer use PCK storage and uses Single Instance Storage ,More about why should move from CM07 to CM12 http://eskonr.com/2013/01/why-should-we-move-from-sccm-configmgr-2007-to-2012/ and

    Single Instance Storage http://blogs.technet.com/b/hhoy/archive/2012/05/31/an-adventure-in-the-sccmcontentlib-single-instance-store.aspx

    If you want to move the PCK files to different drive rather deleting them,Please refer this post http://eskonr.com/2012/10/how-to-move-pck-files-to-different-drive/, For Deletion,continue reading.

    As We all Know,The PCK files are stored on the drive letter that you specify in the hierarchy settings—>software Distribution.

    If you found ,the PCK drive do not have enough disk,try to change the Drive letter to different drive which has more disk space and creating NO_SMS_ON_DRIVE.SMS on the root of the drive to not use for decompressing of the packages,and moving forward,You will no longer have PCK file issues.

    But if you are having Many Packages that are not updated since years,probably it is good Idea delete the PCK for these packages.

    Note:If you later update these packages,Entire PCK files will get copied over the network to the site server,Please pay attention on it.

    I Wrote a Script that checks all the drives if smspkg share exists or not ,If so check the PCK modifiedDate and then Delete if older than 2 Years.

    ' Author:               Eswar Koneti
    ' Title: Script to Delete the PCK files on all the exisiting Drives that are older than 2 Years (730 Days)

    Set objfso = CreateObject ("Scripting.FileSystemObject")
    Set servers = objfso.OpenTextFile ("C:\Scripts\servers.txt", 1)
    Set objoutputfile = objfso.OpenTextFile ("C:\Scripts\PCKResults.txt", 2, True)
    do While Not servers.AtEndOfStream
    strcomputer=servers.readline
    Set objWMIService = GetObject("winmgmts:\\" & strComputer)
    If Err.Number <> 0 Then
    objoutputfile.WriteLine (strcomputer & " is not Up or something went wrong with WMI")
    Err.Clear
    Else
    strDays= 500
    Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_LogicalDisk")
    For Each objdrive in colItems
    drive=left(objDrive.caption,1)
    If (objfso.FolderExists("\\" & strComputer & "\"+Drive &"$\smspkg\")) Then
    set recive = objfso.GetFolder("\\" & strComputer & "\"+Drive &"$\smspkg\")
    Set colFiles = recive.Files
    For Each objFile in colFiles
    filename=objfile
    if (right(FileName, 4) = ".PCK") then
    If DateDiff("d", objFile.DateLastModified, Date) > strDays Then
    objoutputfile.WriteLine objfile & vbtab & "exist on "& vbtab & strComputer & vbtab & "modified date:" & vbtab & objFile.DateLastModified & vbtab & "Size (MB):" & vbtab & int(objFile.Size/1048576)
    objfso.DeleteFile objfile,TRUE
    objoutputfile.WriteLine strComputer & vbTab & "Deleted"
    end if
    end if
    Next
    End if
    Next
    end if
    loop
    msgbox "script is completed"

    Change the quotes as they converted to Fancy by Blog OR use the script from RSS Feeds.

     

    Until next,

    configmgr Delete PCK files disk Space issues Move PCK files.Delete PCK Old PCK PCK SCCM SCCM 2007 script smspkg
    Share. Twitter LinkedIn Email Facebook Reddit

    Related Posts

    SCCM SQL Report – Compare Installed Apps on TWO Different Computers

    July 13, 10:35 am

    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

    4 Comments

    1. Javed on November 22, 2013 4:53 PM

      Hi Eshwar,

      Could you please let me know the steps to be taken to remove old PCK file.
      I am not much expertise in Scripts.
      Do i need to make .vbs file and then run it on the server where i need to remove the files or how.

      Regards
      Zubair

      Reply
      • Eswar Koneti on November 27, 2013 7:31 AM

        you dont have to .if look into the script,it checks the files on remote computers and if they are older than X days,it will remove.
        Just create VBS and run from the anywhere on the network.make sure you have enough rights to remove the files.

        Reply
    2. Lewis on September 10, 2013 6:44 AM

      The quotes weren't changed in the RSS feed 🙂

      Reply
      • Eswar Koneti on September 16, 2013 7:51 AM

        Nice find Lewis 😉 Thanks. I will add this as note going forward.

        Reply

    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-2025 Eswar Koneti, All rights reserved.

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