edited July 2014 in General

Can anyone tell me how i get the script: files_count.vbs to Count files in a specific folder?

When i click the test button in Add Application Schedule i tries to go to this folder: c:\users\xxx\appdata\local\temp\....

There is no where i can find to set up which folder to Count, and also i cant find where to set up if for example the number of files in the folder is x > 10.

thx in advance.


  • You configure the folder as well as the max. number of files in the script itself.

    In the management console, navigate to Tools -> Embedded Scripts and then click on the "files_count.vbs" file.

    On the right pane, look for "MyFolder" and "MyLimit". Change the value of MyFolder to the folder you want to monitor, and MyLimit to the files threshold.

    Does that work?
  • Yes it Works fine, had found out of it in the meantime :o)

    How do i Count files in more folders?

    And how do i now get the email alert configured please ?

    I look forward to hear from you.
  • Currently, the folders are hard-coded into each script, so one approach would be to duplicate the script (e.g. files_count_2.vbs) and create an additional application schedule which then references this file.

    A better solution would probably be to re-factor the script so that it accepts a command line argument representing the folder. E.g., set line 10 of the script to

    MyFolder = WScript.Arguments.Item(0)

    Then, in the application scheduler, call the script like

    @files_count.vbs "C:\Folder 1"

    In regards to the alert, if the file count exceeds the limit, then an alert should automatically be generated and emailed. Have you tried that?

    We have several tutorials which explain how filters work:

    and a few screencasts:

    Hope this helps.
  • ok, thanks, where is the script files_count.vbs located ? i can't find it anywhere when i search the C drive.

    Hope you can help me :)
  • Please see my 2nd comment above, you can find it under Tools - Embedded Scripts.
  • Yes that I know , since I have already used it.

    Where do I physical find the script on the harddrive?, so I can duplicate the scripts as you mention :o)

    I look forward to hear from you again

    Thanks in advance.

  • Hi
    Can you please help me with the above regarding how to copy the script?

    Thanks in advance.

  • Hi Glenn,

    If you don't want to modify the script to use a command line arguments (which I would recommend), then the best way would be to copy the scripts in the embedded script dialog. You can just add a new script there and copy/paste the contents of the existing script.

    The scripts aren't really stored on the file system, they are located in the %systemroot%\syswow64\eventsentry\scrtips folder by default (this can be changed on the bottom of the embedded scripts dialog), but the scripts are dynamically managed by the agent and the permissions on that folder prevent users from accessing them.

    Of course you don't have to use embedded scripts, this is just a feature to help our users manage scripts across multiple servers. You can just create a script anywhere on the file system (e.g. C:\scripts\file_count_1.vbs) and reference that script from the application scheduler. In that case you won't use the leading '@' character (since that implies an embedded script).

    Does this clarify?
Sign In or Register to comment.