How to inventory size of a directory with AM ?
search cancel

How to inventory size of a directory with AM ?


Article ID: 92653


Updated On:


CA Client Automation - Asset Management CA Client Automation - IT Client Manager CA Client Automation


It could be interesting to do an inventory of the size of a specific directory to check if a cleanup should be done.
For example inventory the size of c:\windows\temp of all machines
How to do the size inventory of a specific directory ?


Client Automation - Any Version


1- Download the attached file Dir_Size_Inventory.dms

2- In ITCM Explorer create a new Asset Jobs and choose Job Type "Script"



3- Click Next and give a name to the Job.
Example : Directory Size Inventory

4- Click Next. And load the file Dir_Size_Inventory.dms

Adapt the following sections with name, path and alternative path of directories :

' ------------------------------------------------------------
' Enter list of directories to collect with this form :
' Directory Name;Path;Alternative Path;
' If there is no alternative Path put a .
' Directory Name;Path;.;
' ------------------------------------------------------------
sDir="Temp Directory;C:\TEMP;D:\TEMP;"
'sDir=sDir+"DSM Logs Directory;D:\Program Files (x86)\CA\DSM\logs;C:\Program Files (x86)\CA\DSM\logs;"
'sDir=sDir+"Test Directory;c:\test;c:\test2;"
'sDir=sDir+"Windows Temp;"+sWinDir+"\TEMP;.;"
'sDir=sDir+"Recycle Bin;"+"C:\$Recycle.Bin;D:\$Recycle.Bin;"
'sDir=sDir+"Windows WinSxs;"+sWinDir+"\WinSxS;.;"
'sDir=sDir+"Program Data;"+EnvGetstring("ProgramData")+";.;"


Example :

sDir="Temp Directory;C:\TEMP;D:\TEMP;"
sDir=sDir+"DSM Logs Directory;D:\Program Files (x86)\CA\DSM\logs;C:\Program Files (x86)\CA\DSM\logs;"
sDir=sDir+"Windows Temp;"+sWinDir+"\TEMP;.;"

To collect 3 directories :

C:\TEMP (or D:\TEMP if C:\TEMP does not exist)
D:\Program Files (x86)\CA\DSM\logs (or C:\Program Files (x86)\CA\DSM\logs if D:\Program Files (x86)\CA\DSM\logs does not exist)
C:\windows\TEMP (there is no alternative path)



5- Click NEXT and on "Set Scheduling" button
In Scheduling options, click on Miscellaneous tab and check option "Job is allowed to run unattended"

6- Click OK and FINISH

7- Attach this job to the computers or group of computers.

8- Inventory will appear like this under Additional Inventory folder :

The size appears in different unit sizes : Bytes, KBytes, MBytes, GBytes.