WE had a series of issues with our package server creating blank records and then not deleteing those records or even records we delete out of the console. The file bloat took some doing to get cleared. Parts of this are based ont he post: http://www.symantec.com/business/support/index?pag... with much thanks to Symantec support and the article's editors. I found for us it didn't complete the information eeded to actually clear all the file bloat and the database bloat.
As a quick overview, what I have going on now is every night I run the SQL query modified from above, change permissions on any new packages on all the site servers, then delete empty folders, then delete specific known "bad" or uneeded packages. In my case these are tasks that are dumped into a job which runs at an interval. That way the whole thing can be turned off or on without forgetting a piece and each section can be viewed for status. The exception being the SQL query but I still run that from within the console so it can br grouped with the job.
So first create a the following SQL query task:
INSERT INTO ItemToDelete
SELECT p.Guid, GETDATE()
FROM RM_ResourceSoftware_Package p
LEFT JOIN ItemToDelete d ON d.Guid = p.Guid
WHERE p.name like ''
AND d.Guid is null
Second run a quick command to change the permission so that adminstrators can delete folders in the package directories again.
REM @echo off
REM Give Administrators full permissions on all the package folders on the server
cd "C:\Program Files\Altiris\Altiris Agent\Package Delivery"
takeown /a /r /f "C:\Program Files\Altiris\Altiris Agent\Package Delivery\*"
icacls "C:\Program Files\Altiris\Altiris Agent\Package Delivery\*" /grant Administrators:(F) /inheritance:e
Third step is modified from some script online, source is quoted. This simply finds only the package server folders with nothing in the cache folder. Also note the loggin directory, customize to your site.
@echo off
REM Delete Empty Directories
REM Modified from: http://wishmesh.com/2009/07/batch-script-to-test-i...cd "C:\Program Files\Altiris\Altiris Agent\Package Delivery\"
c:setlocal DisableDelayedExpansion
FOR /D /r %%G in ("*") DO (
set "folder=%%G"
call :testFILE
)
goto end:testFILE
rem {
for /F %%i in ('dir /b /A-D "%folder%\*"') do exit /b
REM if you’re here, directory has no files
call :testDIR
exit /b
rem }:testDIR
for /F %%i in ('dir /b /A:D "%folder%\*"') do exit /b
REM if you’re here, directory has no directories
if not %folder:~-6%==\cache exit /b
echo "%folder%" is totally empty on %computername% at %TIME% on %DATE%. >> \\ns-server\NSCap\logs\list_of_empty_directories.txt
echo the command will be: rd /s/q "%folder:~0,-6%"
rd /s/q "%folder:~0,-6%"
exit /b
:end
echo ####checking for empty folders complete for %computername% at %TIME% on %DATE%. ##### >> \\ns-server\NSCap\logs\list_of_empty_directories.txt
Finally a pretty basic script to delete known bad GUID's of packages etc. But the part that's nice it is easy to add and delete from. I found it nice for netboot folder structures that would not delete:
@echo off
REM Delete unused netboot Directoriescd "C:\Program Files\Altiris\Altiris Agent\Agents\Deployment\SBS\Images\"
c:REM Delete list of known "bad/old" directories
rmdir /s /q "10-9-3_WillTest"
rmdir /s /q "WinPE 4x Scripting+"
rmdir /s /q "WinPE PXE"
rmdir /s /q "WinPE4"REM Check files:
REM Other unneeded packages known to be out of date
rmdir /s /q "C:\Program Files\Altiris\Altiris Agent\Package Delivery\{246D94B4-AA6A-4D6F-8B58-2AC86CE2F3E6}"
rmdir /s /q "C:\Program Files\Altiris\Altiris Agent\Package Delivery\{7ffbb57a-5dbb-4c9d-9a38-6aba03a66002}"
rmdir /s /q "C:\Program Files\Altiris\Altiris Agent\Package Delivery\{C14F9972-AF9E-4E33-A0E4-5D84161BCB9D}"
rmdir /s /q "C:\Program Files\Altiris\Altiris Agent\Package Delivery\{7BFD80A8-0A46-4D87-B108-DBA1F09F8D69}"
rmdir /s /q "C:\Program Files\Altiris\Altiris Agent\Package Delivery\{02C0E30F-57C7-4896-9644-E1D1512A880B}"
rmdir /s /q "C:\Program Files\Altiris\Altiris Agent\Package Delivery\{9BA7970C-8C9C-4D34-8537-F57DB769D050}"exit 0
If time ever allows I would like to create a token for install directory on the individual site servers as this is not very portable at this point, but for our site it works pretty well. Hope this helps a bit. Let me know any thoughts or questions!