Quantcast
Channel: All about Microsoft Endpoint Manager
Viewing all articles
Browse latest Browse all 444

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

$
0
0

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,

SCCM 2007 Script to Delete Old PCK files from SMSPKG folder Avoid Disk Space issues is a post from: Eswar Koneti's Blog


Viewing all articles
Browse latest Browse all 444

Trending Articles