Sending parameters to the script

The GFI LanGuard scanner tool passes parameters to the scripts when executed. Example, the computer name and computer IP of the target machine being scanned for vulnerabilities. To be able to debug your scripts you may want to test with various types of values for these parameters. You can specify alternative values for these parameters from Options > Parameters.

In order to gain access to these parameters in scripts, one has to use a special GFI LanGuard function called GetParameter and pass it the name of the parameter you want, for example:

Function main

'declare the objects we will need to use

Dim wmi As Object

Dim objswbemobject As Object

'declare other variables we need

Dim strComputer As String

Dim cr As String

strComputer = "127.0.0.1"

'Carriage return

cr = Chr(13) + Chr(10)

'hook with the wmi object

Set wmi = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

'Check that hook was successful

If wmi is Nothing Then echo ("error1")

'Return the services instance of the wmi

Set wmiinst=wmi.instancesof("Win32_Service")

'Check to see that instance is available

If wmiinst is Nothing Then echo ("error2")

'Loop true each instance

For Each objswbemobject In wmiinst

echo("Service Name= ")

'Display services

echo(objswbemobject.DisplayName+cr)

Next

End Function