Enhance what the GFI MAX RemoteManagement Dashboard can do with user-defined custom scripts or through our built in library, allowing you to monitor VMWare host server health, exchange store size and queue length. Create your own scripts, or use those generously shared by industry peers on our designated FixitScripts website.
In this session we will cover:
•Building Scripts
•Using Scripts in the Library
•Script Types
•Using “Ones from the Internet”
Keeping your build tool updated in a multi repository world
Scripting and Automation within the MAX Platform Ernest Byrd
1. Scripting & Automated Tasks
A means of doing custom things for your custom Customers
Ernest Byrd, Sales Engineer
GFI MAX
2. Agenda
» Why use Scripting?
» Plug it in
» Turn it on: Using a Script
» FixITScripts.com
» Interfacing with the MAX Remote Management Dashboard
» Basic Scripts
» Using a Script as an Automated Task
» Basic Troubleshooting
» Pseudo-Code and Modeling
» Deeper Dive
4. “EASY does it”
Here at GFI MAX we aim for ease of use while
remaining Comprehensive. With that said, there is
always going to be a Customer that has specific and
UNiQUe needs.
If we fulfilled the needs of every Customer in our
Dashboard, GFI MAX could be quite overwhelming.
In order to remove complexity we have available the
Scripting & Automated Tasks solution sets. These
enable YOU to simply “plug in” a script, having it
available for Automated Processes.
Scripts can then be utilized by Superusers or
Administrators within your Dashboard in order
accomplish tasks across both small and larger
Managed Networks.
5. What are some things that can be accomplished with Scripting?
» File and Folder manipulation
» System Cleanup
» Localized Tasks
» Creation of Mapped Drives
» Informational Output
» Application Download
…The List goes on…
14. The Script Writing Guidelines can be found in the Help Files at:
https://dashboard.systemmonitor.us/helpcontents/script_guide.htm
To locate the GFI MAX Remote Management Help Files:
15. » The Windows Advanced Monitoring Agent supports the following script types where there is an
interpreter installed. DOS Batch, JavaScript, Perl, PHP, PowerShell, Python, Ruby, VBS and
CMD.
» The Linux Monitoring Agent and OSX Monitoring Agent supports Shell scripts and interpreted
languages such as Perl, PHP, Python, Ruby for which there is a handler installed.
» The status of the script - pass or fail - can be reported to the DashBoard through exit codes. Zero
indicates success, with any other number recorded as a failure.
Please note, we have reserved the exit codes 1 to 999 for use by the system scripts. As such we would
suggest returning an exit code greater than 1000 in your scripts to ensure the text output is displayed
correctly in the DashBoard.
Exit Code Result
0 Pass
>0 Fail
1 - 999 Reserved exit codes
>1000 Displays text output in DashBoard
16. If a Fail is reported to the Dashboard, within the Dashboard you will see:
If a Pass is reported to the Dashboard, within the Dashboard you will see:
To output text from the script to the DashBoard, simply echo from the script to standard output
(stdout).
» For example in DOS Batch, VBScript and Powershell this can be achieved by:
Pass Fail
DOS Batch echo “Success Message” echo “Error Message”
exit 0 exit 1001
VBScript wscript.echo( “Success Message” ) wscript.echo( “Error Message” )
wscript.Quit(0) wscript.Quit(1001)
PowerShell Write-Host “Success Message” Write-Host “Error Message”
Exit 0 Exit 1001
18. Hello World
Example:
Writing a Script, in VBScript
language, that will return the
text “Hello World” into the MAX
Remote Management
Dashboard. The returned
information can then be seen in
the Script Check’s “Extra”
(Informational) Column…
19. Hello World: Interactive Output
If the Script is double-clicked on, here is what is
seen:
» Note that no prompts for User Input are
seen, and the Script executes to completion.
20. Hello World: Calling Script from Command Line
Example:
Calling on HelloWorld.vbs from
Command Line…
21. Hello World
Once this script is plugged into the Dashboard and called on as a “Script Check”, the
following results should appear:
22. Report a Failure to the MAX Remote Management Dashboard
Script Contents:
'Report Fail to Dashboard
wscript.Quit(1001)
Dashboard Output:
23. Script to accept Command Line Variables
Script Contents:
'Accept Command Line Variables and Return to Dashboard
Dim Arg1
Dim Arg2
Arg1 = Wscript.Arguments.Item(0)
Arg2 = Wscript.Arguments.Item(1)
Wscript.Echo Arg1 & Arg2
Dashboard Output:
24. Supplying Command Line Variables
When viewing the Properties of a Script
Check, there is a field to provide Command
Line Variable(s). This is where Scripts that
are written to accept Command Line
Variable(s) can be given input.
25. Enumerating Class Variables from Win32_UserAccount
Example:
Calling to the
“Win32_UserAccount” object in
Windows, ensuring access to
items within on my target
device. This can then serve as a
component into a larger Script if
successful…
28. Using a Script as an Automated Task
Example:
Using the Maintenance
Window script, seen at
www.allthingsmax.com,
as an Automated Task
(http://www.allthingsmax.com/2014/
03/give-me-break.html)…
30. Troubleshooting 101
Essentially, once the script is plugged in to the GFI MAX Remote Management Dashboard and called
on as:
» A Script Check
OR
» An Automated Task
…the script will execute in a command line fashion, running under the account which loads the
“Advanced Monitoring Agent” Service.
31. Troubleshooting 101
What this means: The Script which you are utilizing should not require any user input or
interaction. If your script requires this, it will halt at the point of requirement and never
allow the script to reach completion.
Also, it is good to note that the default account for the “Advanced Monitoring Agent”
Service is: Local System.
32. Troubleshooting 101
“My script runs as intended when I double click it, or call on it from command line. How
can I make it work in the GFI MAX Remote Management Dashboard?”
If your script runs properly under a logged on account:
» Review the account you are logged in with when running the script
» Change your “Advanced Monitoring Agent” Service on the intended device to run with this same
account
(To find the account you are logged in with, the use of a command line call: WhoamI may be helpful.)
34. Script Development Essentials
» Summarize what your Script or Automated Task is going to accomplish. This should be
something that you can define in one or two sentences.
» Write/Draw out the Logic used to develop your Script. This is commonly referred to as Pseudo-coding.
» Convert your Pseudo-code into the desired Scripting language.
If Then
-If Then
-
Else
While is Not
Do