Menu

Search



Using a Configuration Group to Check Size of a File

New Boundary Support
Tips & Tricks

The information in this article applies to: Prism Suite, Prism Deploy

 

Problem:

It would be useful to have a configuration group that checks for the size of a particular file. For example, file size can sometimes be used to determine what version of an application is installed. However, there currently isn’t a user-defined parameter to check for file size.

 

Resolution:

NBT Support has come up with a workaround using a VB script. The process is to create and run a VB script that captures the size of the file and writes that information to an INI file. You can then use the INI file in a configuration group ruleset to see the file’s size. In our example below, we’re checking the size of the Prism client file.

 

First, use notepad to create a .vbs script with the lines shown below. On line 1, specify the path to the file you're interested in. On line 5, specify the path and file name for the INI file that will be created.

 

Const filename = "C:\Program Files\New Boundary\Client\PTClient.exe"

Dim objFSO, objFile, objINIFile

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objFile = objFSO.GetFile(filename)

Set objINIFile = objFSO.CreateTextFile("C:\Program Files\New Boundary\Client\PTClientsize.ini",2)

objINIFile.WriteLine "[PTClient size]"

objINIFile.WriteLine "bytes="& objFile.Size

objFile.Close

 

This script will calculate the size of the "C:\Program Files\New Boundary\Client\PTClient.exe" file and then store the value in a file called PTClientsize.ini in the C:\Program Files\New Boundary\Client folder. You can assign the script.vbs to all your machines as a command Task.  The format of this Task would look something like "cscript \\server\share\script.vbs".  After the Task has run, each machine will have an INI file created in the C:\Program Files\New Boundary\Client folder that tells how big each machine's PTClient.exe file actually is.

           

The next step is to create a User-defined Configuration Group to query the INI file. For example:

 

<INI Value> "C:\Program Files\New Boundary\Client\PTClientsize.ini\\PTClient size\\bytes" = "2097152"

 

This Configuration Group will then populate with any computer that has an INI file named PTClientsize.ini in the C:\Program Files\New Boundary\Client folder and has a bytes value equal to 2097152. Note that the odds are not very good that PTClient.exe is exactly 2MB (2097152 bytes) in size.  You may want to look at a few copies of the file and note what the size in bytes is.  That way you could create a configuration group that checks for a range like > 2000000 and < 2200000.


Also In This Category


On a scale of 1-5, please rate the helpfulness of this article


Not Helpful
Very Helpful
Optionally provide your comments to help us improve this article...

Thank you for your feedback!

Add Your Comments
Name:
Email Address:
RadEditor - HTML WYSIWYG Editor. MS Word-like content editing experience thanks to a rich set of formatting tools, dropdowns, dialogs, system modules and built-in spell-check.
RadEditor's components - toolbar, content area, modes and modules
   
Toolbar's wrapper  
Content area wrapper
RadEditor's bottom area: Design, Html and Preview modes, Statistics module and resize handle.
It contains RadEditor's Modes/views (HTML, Design and Preview), Statistics and Resizer
Editor Mode buttonsStatistics moduleEditor resizer
 
 
RadEditor's Modules - special tools used to provide extra information such as Tag Inspector, Real Time HTML Viewer, Tag Properties and other.
   
Verification Code:
Details
Last Modified: 17 Years Ago
Last Modified By: New Boundary Support
Type: HOWTO
Article not rated yet.
Article has been viewed 5.9K times.
Options
Customer Support Software By InstantKB 2015-2
Execution: 0.000. 9 queries. Compression Disabled.