Remove Orphaned Packages From the PS


Article ID: 179629


Updated On:


Management Platform (Formerly known as Notification Server)




When package directories exist on the Package Server for packages that no longer exist on the NS, how can the cleanup of these directories be handled in an automated fashion?


Download and configure the attached vbs file.  Once configured, use a Software Delivery job to execute the script against all of the package servers in your environment.

1 - Download the Package_Cleanup.vbs

2 - Edit the Package_Cleanup.vbs file to provide SQL connection information.

      a.  SQL Server IP Address

      b.  Database name for the NS

      c.  SQL Server account for authentication.  Account must have DB_Datareader rights to the Altiris DB.

      d.  SQL Server account password.

3 - Save changes to the file and add it to a SWD package.  The command line in the package should be "CScript.exe Package_Cleanup.vbs"

4 - Target the SWD job to the Package Servers in the environment and schedule execution.

When executed, the script will connect to the database for the NS and compare the known packages on the NS to the package directories on the PS.  If any package directories exist on the PS that are not for known packages on the NS, these directories will be deleted from the PS.  Any associated package status for the targeted deletions will also be deleted and the client policy for the PS will be cleared.  The agent will then restart and download a fresh client policy.


Package_Cleanup.vbs get_app
Package_Cleanup.vbs get_app