Question
My managed desktops have thousands of NSE .tmp files sitting in the Altiris Agent queue directory on their local hard drives; I know that files between a certain size are causing problems on my Notification Server. How can I delete those files?
Answer
The following VBS script will reconfigure the Altiris Agent in situations where a lack of communication or GUID duplications make it impossible to reinstall or configure the agents.
The script will clean out the contents of the Queue directory where files are between the Minimum and Maximum file sizes specified, and then force "basic inventory" and policy updates (ignoring blockouts).
'vbscript
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
' Description:
' Script to reconfigure Altiris Agent in situations where a lack of communication or GUID duplications make it
' impossible to reinstall or configure agents.
'
' This script will:
' 1.) Clean (deletes) the contents of the Queue directory based on the Minimum and Maximum file
' sizes specified
' 2.) Force basic inventory and policy updates (ignoring blockouts)
'
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''Option Explicit
Dim oFS, WshShell, oShell, objApp, AltirisIns, Server, Path, Policies, Software, client, policymgr, ignoreBlockouts, sendIfUnchanged, serverconf, webconf, cliguid
Dim output
Dim MinFileSize, MaxFileSize, File
Set WshShell = Wscript.CreateObject("wscript.shell")If WScript.Arguments.Count <> 2 Then
WScript.Echo "DeleteQueueBySize.vbs"
WScript.Echo "---------------------"
WScript.Echo "Usage: CScript DeleteQueueBySize.vbs <MinFileSize> <MaxFileSize>"
WScript.Echo "(Please specify file sizes in Bytes, e.g. 10k = 10240, 15k = 15360, 20k = 20480)"
WScript.Quit
End If'Set minumum and maximum files size limits
MinFileSize = WScript.arguments(0)
MaxFileSize = WScript.arguments(1)'Will look where is the agent location
AltirisIns=WshShell.RegRead ("HKLM\Software\Altiris\Altiris Agent\InstallDir")'Will look for the server directory
Server=WshShell.RegRead ("HKLM\Software\Altiris\Altiris Agent\Servers\")set oFS=createobject("scripting.filesystemobject")
'Deletes files in Client Policies
Policies=AltirisIns+"\Client Policies\*.*"
oFS.deletefile Policies'Set path to folder to be checked as queue\<server name>
Path=AltirisIns+"\queue\"+Server' Checks files in the relevant queue subfolder and deletes any between the min and max sizes
For each File in oFS.GetFolder(Path).Files
If ((File.Size >= int(MinFileSize)) and (File.Size <= int(MaxFileSize))) Then
oFS.DeleteFile file
End If
Nextset client = wscript.createobject ( "Altiris.AeXNSClient" )
'Force Basic Inventory
ignoreBlockouts = 1
sendIfUnchanged = 1
client.SendBasicInventory sendIfUnchanged, ignoreBlockouts
WScript.Sleep(3000)'Force Policy Update
client.UpdatePolicies ignoreBlockoutsSet WshShell = Nothing
The script should be executed with the following command line:
cscript DeleteQueueBySize.vbs <MinFileSize> <MaxFileSize>
where <MinFileSize> and <MaxFileSize> are specified in bytes.
To run this script remotely on your managed desktops, you can use any one of a number of methods, including via a Windows login script, or through a Deployment Server or Software Delivery job.