Orax SDI Cloud Reference

 
  1. Introduction
  2. Self-Management tools
  3. Communication and Content management
  4. Sales and Customer Relationship Management
  5. Services & Service level management
  6. Billing and customer statements
  7. Inventory & Asset management
  8. Production management
  9. Human Resources and Payroll
  10. Procurement and Supply chain
  11. Ledgers & Accounting
  12. Reporting and Analytics
  13. Administration & configuration
    Up    Previous    Next

Scripting for Windows Agents

Windows Service Agents (Orax SDI Agent) V6.0.W and higher (released after April 2020) are able to execute Batch, PowerShell and VBS scripts. Older versions of the Orax SDI Agent will be deprecated in June 2020.

Command script example:
hostname

PowerShell script example:
powershell /C "Get-WmiObject Win32_Processor | Measure-Object -Property LoadPercentage -Average | Select Average | Format-Table -HideTableHeaders"

VBScript examples:
Using the BEGIN_SCRIPT, END_SCRIPT and EXEC_SCRIPT format for Windows agents, you are able to create and execute VBScript on the Agent. It is important to use CScript to execute/call the VBScript as it will ensure that the output of the script is returned to the agent.

eg.

BEGIN_SCRIPT
... your vbs code ...
END_SCRIPT
cscript /nologo EXEC_SCRIPT

You may also pass Parameters to your VBScript as such:

cscript /nologo EXEC_SCRIPT par1 par2

On Windows it is also important to understand that only the first Agent command's output (in a list of commands) will be returned, so it is best to always have only one command line.

eg.
echo one
echo two
echo three

will only return "one".

When using the above method to create VBScripts, the Orax Agent will create a script file called oraxagent.vbs, that contains the code between BEGIN_SCRIPT and END_SCRIPT. It then replaces EXEC_SCRIPT with oraxagent.vbs. So your command,

cscript /nologo EXEC_SCRIPT

becomes

cscript /nologo oraxagent.vbs

Using metric types as examples, create or customize metrics in VBScript for your agents. Add effective scripts to metric types so they can be reused.

Below is an examples:

BEGIN_SCRIPT
Dim oWsh, oWshSysEnv, objFSO, objWMIService
Dim oDrives, oDrive, objOutFile, colItems, objItem
Dim strLineTime, strLineProcessorTime, strLineDriveSpace, strLinePercentCommittedBytesInUse, strMaxUsed

Set oWsh = WScript.CreateObject("WScript.Shell")
Set oWshSysEnv = oWsh.Environment("PROCESS")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")

Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PerfFormattedData_PerfOS_Processor WHERE Name = '_Total'")
For Each objItem In colItems
strLineProcessorTime = strLineProcessorTime & " " & objItem.PercentProcessorTime
Next

wscript.echo strLineProcessorTime
END_SCRIPT
cscript //Nologo EXEC_SCRIPT


 

    Up    Previous    Next