About automation components

To make calls to automation components, the CreateObject function is used. This function returns an object that links to the automation you want to use.


To use Microsoft’s © Regular Expression Object:

Function Main

Dim regexp As Object

Dim test As String

Set regexp = CreateObject("VBScriptA Visual Basic Scripting language is a high-level programming language developed by Microsoft®..RegExp")

regexp.pattern = "[A-Za-z]:(\\[A-Za-z0-9_.-])*"

test = "c:\windows\"

If regexp.test(test) Then

echo("This is a path")


echo("This is not a path")

End If

End Function

The above example uses regular expression to check if the variable test holds a path or not.

The flexibility of this system not only allows using these objects to enhance GFI LanGuard scripts, but also allows the scripting engine to be used for any needed purpose. Example, it is now possible to create a script to scan for signs of a Worm X, clean it if found and also generate a report in Excel as reference of the changes made, while displaying in GFI LanGuard that a worm was found and cleaned successfully.

Below is an example of such automation, the script lists the services running on the local machine and their status into an excel worksheet. This particular example requires Excel to be installed and also the availability of WMI which should be pre-installed on Windows 2000 machine upwards.