Mcafee Epolicy Orchestrator 5.1.0 Software: Reference Guide
Mcafee Epolicy Orchestrator 5.1.0 Software: Reference Guide
TRADEMARK ATTRIBUTIONS
McAfee, the McAfee logo, McAfee Active Protection, McAfee CleanBoot, McAfee DeepSAFE, ePolicy Orchestrator, McAfee ePO, McAfee EMM, Foundscore,
Foundstone, Policy Lab, McAfee QuickClean, Safe Eyes, McAfee SECURE, SecureOS, McAfee Shredder, SiteAdvisor, McAfee Stinger, McAfee Total
Protection, TrustedSource, VirusScan, WaveSecure are trademarks or registered trademarks of McAfee, Inc. or its subsidiaries in the United States and
other countries. Other names and brands may be claimed as the property of others.
Product and feature names and descriptions are subject to change without notice. Please visit mcafee.com for the most current products and features.
LICENSE INFORMATION
License Agreement
NOTICE TO ALL USERS: CAREFULLY READ THE APPROPRIATE LEGAL AGREEMENT CORRESPONDING TO THE LICENSE YOU PURCHASED, WHICH SETS
FORTH THE GENERAL TERMS AND CONDITIONS FOR THE USE OF THE LICENSED SOFTWARE. IF YOU DO NOT KNOW WHICH TYPE OF LICENSE YOU
HAVE ACQUIRED, PLEASE CONSULT THE SALES AND OTHER RELATED LICENSE GRANT OR PURCHASE ORDER DOCUMENTS THAT ACCOMPANY YOUR
SOFTWARE PACKAGING OR THAT YOU HAVE RECEIVED SEPARATELY AS PART OF THE PURCHASE (AS A BOOKLET, A FILE ON THE PRODUCT CD, OR A
FILE AVAILABLE ON THE WEBSITE FROM WHICH YOU DOWNLOADED THE SOFTWARE PACKAGE). IF YOU DO NOT AGREE TO ALL OF THE TERMS SET
FORTH IN THE AGREEMENT, DO NOT INSTALL THE SOFTWARE. IF APPLICABLE, YOU MAY RETURN THE PRODUCT TO MCAFEE OR THE PLACE OF
PURCHASE FOR A FULL REFUND.
Preface 5
About this guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Find product documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1 Overview 7
Web API basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Discover available commands through URLs . . . . . . . . . . . . . . . . . . . . . . . 9
Example task using the web API . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Python client basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Web API Python script requirements . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Import the McAfee Python client library . . . . . . . . . . . . . . . . . . . . . 13
Script McAfee ePO server authentication . . . . . . . . . . . . . . . . . . . . . 13
Discover available commands in Python . . . . . . . . . . . . . . . . . . . . . . . . . 14
Additional documentation included with the web API . . . . . . . . . . . . . . . . . . . 15
Key commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3 Remote queries 27
Persistent queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Ad-hoc queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Create an ad-hoc query from a query definition . . . . . . . . . . . . . . . . . . 30
Get information about registered databases and tables . . . . . . . . . . . . . . . 31
Queries with joins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Retrieve hierarchical query results . . . . . . . . . . . . . . . . . . . . . . . 33
Limit query result depth . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Remote query commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Ad-hoc query reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
General query datatypes . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
General S-Expression operations . . . . . . . . . . . . . . . . . . . . . . . . 35
S-Expression operator and datatype combinations . . . . . . . . . . . . . . . . . 37
Special ePolicy Orchestrator datatypes . . . . . . . . . . . . . . . . . . . . . . 38
Special ePolicy Orchestrator operators . . . . . . . . . . . . . . . . . . . . . . 38
Special ePolicy Orchestrator operator and datatype combinations . . . . . . . . . . . 39
Index 41
Contents
About this guide
Find product documentation
Audience
McAfee documentation is carefully researched and written for the target audience.
The information in this guide is intended primarily for:
• Administrators — People who implement and enforce the company's security program.
• Security officers — People who determine sensitive and confidential data, and define the
corporate policy that protects the company's intellectual property.
Conventions
This guide uses these typographical conventions and icons.
Book title, term, Title of a book, chapter, or topic; a new term; emphasis.
emphasis
Bold Text that is strongly emphasized.
User input, code, Commands and other text that the user types; a code sample; a displayed
message message.
Interface text Words from the product interface like options, menus, buttons, and dialog
boxes.
Hypertext blue A link to a topic or to an external website.
Note: Additional information, like an alternate method of accessing an
option.
Tip: Suggestions and recommendations.
Task
1 Go to the McAfee Technical Support ServicePortal at http://mysupport.mcafee.com.
To access... Do this...
User documentation 1 Click Product Documentation.
KnowledgeBase • Click Search the KnowledgeBase for answers to your product questions.
• Click Browse the KnowledgeBase for articles listed by product and version.
McAfee® ePolicy Orchestrator® provides a web application programming interface (API) that allows you
to script and automate common management activities. For example, you can automate user and
System Tree maintenance and data import and export.
This guide explains what the ePolicy Orchestrator web API is, how to use it, and walks you through a
few examples using a Python client. It also includes a detailed look at some key commands and an
extensive description of the query system.
Contents
Web API basics
Discover available commands through URLs
Example task using the web API
Python client basics
Web API Python script requirements
Discover available commands in Python
Additional documentation included with the web API
Key commands
Each cURL example includes standard parameters followed by the actual ePolicy Orchestrator web API
URL that executes a command on your McAfee ePO server. These parameters should help you to
understand what the command does, although in practice you should implement tighter security when
it comes to trusting the site's certificate.
The ePolicy Orchestrator web API supports using other command-line tools, for example wget (part of
the GNU Project, © 2009, Free Software Foundation, Inc.), to retrieve data from your McAfee ePO
server.
This command, for example, shows the cURL syntax and the URL to illustrate the core capabilities of
the web API.
This table shows the parameters used with the curl command example.
Parameter Description
‑k Allows cURL to perform "insecure" SSL connections and transfers.
‑u Specifies the user name and password to use for server authentication. If you enter
just the user name (without a colon) cURL prompts you for a password.
ga User name, "ga", global administrator used in this document's examples.
You can use special characters in your user names, but make sure you follow your shell's
quoting and escaping rules.
You can use special characters in your passwords, but make sure you follow your shell's
quoting and escaping rules.
In the examples in this document, the McAfee ePO server and destination port are identified as
"localhost" and "8443" (the default). You need to replace these entries with the server name and port
number of your own installation.
Web API commands follow all role-based permissions as enforced through the McAfee ePO server
graphical interface.
Scripts using the web API can be run from any computer that can connect to the McAfee ePO server.
For security reasons, these commands should not be run on the same computer as the McAfee ePO
server itself.
General syntax
The general syntax for a command sent via HTTPS is:
https://<server>:<port>/remote/<command>?<arg1>=<val1>&<arg2>=<val2>
Output options
By default, commands return output in a human-readable format. When scripting, however, you
usually want commands to return data in a more machine-readable format. This format is controlled
with the :output parameter.
https://localhost:8443/remote/core.help?:output=json
This example returns data in JavaScript Object Notation (JSON) format. Other options include verbose
(default), terse, and xml. These arguments must be supplied as all lowercase text. In addition, the
parameters shown in this table are available.
Use the core.help command to learn which commands you can access and the details of specific
commands. When used without any arguments, core.help provides a list of available commands.
The exact list of commands displayed depends on your permissions and the extensions installed.
OK:
ComputerMgmt.createCustomInstallPackageCmd windowsPackage deployPath [ahId] [fallBackAhId]
[useCred] [domain] [username] [password] [rememberDomainCredentials] -
ComputerMgmt.create.Custom.Install.Package.Cmd.short-desc
agentmgmt.listAgentHandlers - List all Agent Handlers
clienttask.export [productId] [fileName] - Exports client tasks
clienttask.find [searchText] - Finds client tasks
clienttask.importClientTask importFileName - Imports client tasks from an XML file.
clienttask.run names productId taskId [retryAttempts] [retryIntervalInSeconds]
[abortAfterMinutes] [useAllAgentHandlers] [stopAfterMinutes] [randomizationInterval] - Runs
the client task on a supplied list of systems
clienttask.syncShared - Shares client tasks with participating registered servers
commonevent.purgeEvents queryId [unit] [purgeType] - Deletes threat events based on age or a
queryId. The query must be table based.
commonevent.purgeProductEvents queryId [unit] [purgeType] - Purge Client Events by Query ID
or age.
console.cert.updatecrl console.updateCRL crlFile - cert.update.crl.help.oneline
core.addPermSetsForUser userName permSetName - Adds permission set(s) to specified user
core.addUser userName password [fullName=<>] [email=<>] [phoneNumber=<>] [notes=<>]
[disabled=<>] [admin=<>] - Adds a user to the system
core.executeQuery queryId [database=<>] - Executes a SQUID query and returns the results
.
[information deleted]
.
system.report names - Reports the systems in the System Tree
system.runTagCriteria tagID [resetTaggedSystems] - The Run Tag Criteria action evaluates
every managed system against the tag's criteria. system.setUserProperties names
[description] [customField1] [customField2] [customField3] [customField4] - Sets user
properties on the given system
system.transfer names epoServer - Transfers systems to a different ePO server
system.wakeupAgent names [fullProps] [superAgent] [randomMinutes] [forceFullPolicyUpdate]
[useAllHandlers] [retryIntervalSeconds] [attempts] [abortAfterMinutes] [includeSubgroups] -
Wakes up the agent on a supplied list of systems
tasklog.listMessages taskLogId - Lists the messages for the specified task log entry
tasklog.listSubtasks taskLogId - Lists subtasks of a specified task log entry
tasklog.listTaskHistory [taskName] [taskSource] [maxRows] [age] [unit] - Lists
task log entries, optionally filtered by task name, task ID or task source
tasklog.listTaskSources - Lists the task sources
tasklog.purge [age] [unit] - Purges the Server Task Log beyond a given age and time unit
• Required arguments and optional arguments. Optional arguments are enclosed in square brackets
("[" and "]").
Arguments followed by =<> require the specific argument name and a value. For example, if the
command help shows [email=<>] you must provide the argument name and the value, as in
[email protected].
This extended command example is used to request more detailed information about a specific
command.
> curl -k -u ga:ga https://localhost:8443/remote/core.help?command=core.listQueries
Task
1 Use this Help request to find out what the policy.assignToGroup command requires.
This Help request shows that there are three required arguments:
• Group ID
You could also reset the inheritance, but that argument is not required, and is not used it in this
example.
groupId: 4
groupPath: My Organization\My Group
3 Use this policy.find command to find the product ID and policy object ID:
featureId: VIRUSCAN8800
featureName: VirusScan Enterprise
objectId: 142
objectName: My Default
objectNotes:
productId: VIRUSCAN8800
productName: VirusScan Enterprise 8.8.0
typeId: 67
typeName: Quarantine Manager Policies
4 Choose one of policy.find results. This example uses the My Default policy and you have all the
information you need to assign a policy to a group with this information:
• Group ID — 4
• Product ID — VIRUSCAN8800
5 Use the previous information and this policy.assignToGroup command to assign a policy to a
group:
This returns:
OK:
True
If you connect to ePolicy Orchestrator 5.x using the ePolicy Orchestrator 4.6.x Python client you might
experience intermittent connection errors. ePolicy Orchestrator 5.x users should download the ePolicy
Orchestrator 5.x Python client available from the Software Manager.
The source code to the client, which is included, can be used for educational purposes, porting to
other languages, or expanding the Python client's capabilities.
Notes on parameters
Some commands, such as system.clearTag, can take a comma-delimited list of values as a
parameter. If you want to embed spaces in this list, enclose the entire list in quotes.
mc.system.clearTag("System1, System2, System3","oldTag")
Any parameter requiring a file name uses the file:///c:/path/to/file format used in URLs.
See also
Web API Python script requirements on page 13
In this example:
• import mcafee — Imports the McAfee Python client library into your script. See Import the McAfee
Python client library.
After you complete these two tasks, the remainder of the script functions as expected.
See also
Import the McAfee Python client library on page 13
Script McAfee ePO server authentication on page 13
Task
1 Make sure the mcafee.py file is stored in either the same folder as your script, or in the Python
module search path.
2 Import the client code into your script with this command:
import mcafee
This command imports the McAfee ePO server client code, which includes a method that takes
connection information, establishes a session with the indicated server, and returns a session object.
The password used in your script is stored in plain text. Secure your scripts appropriately.
Alternatively, either prompt your user for a password, or store the password encrypted.
The web API does not support certificate authentication.
Authentication examples
If you normally log on to your ePOserver on port 8443 with the user name adminfred and password
mydOgsname37, your Python command to log on is:
mc = mcafee.client("ePOserver","8443","adminfred","mydOgsname37")
The mc variable stores the session information used for all later commands in that script. For example,
if the next thing you want to do in the script is list all currently running server tasks, the command is:
mc.scheduler.listRunningServerTasks()
Task
1 Use the Python dir() command to find the list of modules available.
>>> dir(mc)
There are a number of attributes in the example, but what you are looking for are the names at the
end of the list without leading underscores. In this example, these are core, help, scheduler, and
tasklog. These objects contain commands you can execute.
The other attribute names with leading underscores are internal to either the client or Python itself.
2 Use the dir() command, passing the module as a parameter, to find the list of commands in a
module.
>>> dir(mc.scheduler)
This command returns a list of attributes and commands in the scheduler module similar to this:
['__doc__', '__getattr__', '__init__', '__module__', '_invoker', '_module',
'cancelServerTask', 'getServerTask', 'listAllServerTasks', 'listRunningServerTasks',
'runServerTask', 'setServerTaskStatus']
As in the previous step, look for names without leading underscores. In this case, there are six
commands: cancelServerTask, getServerTask, listAllServerTasks, listRunningServerTasks,
runServerTask, and setServerTaskStatus.
3 Once you've found a command you want to use, type help() and pass the command as a
parameter.
>>> mc.help('scheduler.listRunningServerTasks')
This description lists the command name and parameters (in this case there aren't any), a
description of what it does, and the permission required to execute it.
Perform similar steps for any command you want to run. These steps help determine all capabilities
available for your scripts.
Key commands
Some commands are more commonly used than others. To create scripts quickly, we recommend that
you familiarize yourself with the syntax for these common commands.
These tables list commonly used commands with their syntax and description. Each table covers a
different functional area.
Specify arguments followed by =<> by name. For example, the argument fullName= must be included
in this command, core.addUser("ga", "ga", fullName="Joe Tester")
Creating some example Python scripts can show you the various ways scripting can help keep your
McAfee ePO servers maintained and up-to-date.
Go through these scripts, taken from differing categories of tasks, in this order.
2 Take a tag as input and send a McAfee Agent wake-up call to all systems with that tag.
4 Import computers from an external file and adding them to the System Tree.
5 Export policies and client tasks from one McAfee ePO server and import them into another.
These scripts slowly build on each other and the concepts explained.
Contents
Example 1: Tag systems from a list
Example 2: Automate repetitive tasks on managed systems
Example 3: Automate user management
Example 4: Import computers from external sources
Example 5: Import and export data
Example 6: Automate maintenance of the System Tree
• You want to apply a specific tag, in this example myTag, to every system in that list
A more robust script would manage those assumptions, but that would complicate the example.
#Example 1
import mcafee
mc = mcafee.client('localhost','8443','ga','ga')
import mcafee
The next line creates the connection to the McAfee ePO server by specifying the server name,
connection port, user name, and password, in that order.
This initialization function can take up to two more parameters that specify the protocol and the
presentation of the output.
mc = mcafee.client('localhost','8443','ga','ga')
mc = mcafee.client('yourservername','port','username','password', 'protocol',
'outputtype')
• The protocol defaults to https on your McAfee ePO server.
• The outputtype determines the format of output from commands as described in Web API Basics.
These lines iterate through the file, run the command system.applyTag to each system in the file,
while stripping out the newline ('\n'):
After finishing the loop, each system in the file has the tag myTag applied.
#Example 2
import mcafee
mc = mcafee.client('localhost','8443','ga','ga')
input = 'myTag'
systems = mc.system.find(input)
for system in systems:
id = system['EPOComputerProperties.ParentID']
result = mc.system.wakeupAgent(id)
This script takes a single argument as input, in this example myTag. It uses the system.find
command to search for all computers with that tag.
Your input could be something other than a tag, for example the system.find command description
displays "Find Systems in the ePolicy Orchestrator tree by name, IP address, MAC address, user name,
AgentGUID, or tag."
id = system['EPOComputerProperties.ComputerName']
You could build a comma-delimited string and send the list to the command directly since
system.wakeupAgent also accepts a list of names or IDs as input.
Also, this script provides examples of more detailed handling of actions, plus an exception when the
user deletion is unsuccessful.
#Example 3
import mcafee
mc = mcafee.client('localhost','8443','ga','ga')
users = mc.core.listUsers();
for user in users:
if user['disabled'] == True and user['admin'] == False:
name = user['UserName']
try:
mc.core.removeUser(name)
except Exception, e:
print 'Error ' + str(e)
To see the available properties examine the output from the core.listUsers command. This script
uses the disabled, admin, and UserName properties to find and remove specific users.
The core.removeUser command requires administrator rights to execute. Required permissions for
each command are listed in its detailed help.
The core.listUsers command returns different values for the authType. This table lists the
human-readable formats, used in the user interface, and the machine-readable formats.
• systemsToAdd.txt — Contains one system per line with comma-delimited properties in this order:
MAC address, IP address, system name, and domain name
#Example 4
import mcafee, sys
mc = mcafee.client('localhost','8443','ga','ga','https','json')
if groupId == -1:
error = 'Error finding the specified group.'
sys.exit(error)
#now that we have the group id, pull in the systems from file
sourceId = "12"
sourceType = "CLI"
file = open('C:/systemsToAdd.txt', 'r')
for line in file:
sysProps = line.rstrip('\n').split(',')
# Contains line break at "\"
systemId = mc.detectedsystem.add(sourceId,sourceType,sysProps[0],sysProps[1],dnsName= \
sysProps[2],do main=sysProps[3])
mc.detectedsystem.addToTree(str(systemId),str(groupId))
This example first determine where to add the systems using the system.findGroups() command
searches for the group by name and, using that name, obtains the group ID.
The systems are added to the group with the detectedsystem.add command. This command has
these optional parameters:
You can add optional parameters in order (using any values for parameters you aren't providing).
These optional parameters are, for example:
You can also assign parameters by name with the dnsName and domainName parameters in this script.
The parameters sourceID and sourceType are arbitrary values defined when you add the systems.
These parameters are stored in the database to record what source detected, or added, any given
system.
The return value of this command is the ID of the newly added detected system. You use this ID as
input to this command () which adds detected systems to the System Tree.
By default, the system is not added if it's a duplicate and it is not automatically sorted, but you can
override these defaults if you want. This script accepts the defaults and, using the newly obtained
detected system ID and the group ID, moves this system into the System Tree.
#Example 5
import mcafee
mc = mcafee.client('localhost','8443','ga','ga','https','json')
if productId == None:
error = 'Error finding the product id.'
sys.exit(error)
tasks = mc.clienttask.export(productId=productId)
file = open('tasks.xml', 'w')
print >>file, tasks
file.close()
policies = mc.policy.export(productId=productId)
file = open('policies.xml', 'w')
print >>file, policies
file.close()
The script retrieves the product ID by searching for a policy containing the string 'McAfee Agent'.
Using that product ID, you can export all client tasks and policies for that product.
To import the tasks and policies, create a connection to a second ePolicy Orchestrator server (mc2) and
run the corresponding import commands.
#Example 6
import mcafee
mc = mcafee.client('localhost','8443','ga','ga','https','json')
if groupId == -1:
error = 'Error finding the specified group.'
sys.exit(error)
This example is fairly straightforward given the previous example scripts. This example introduces a
new command, epogroup.findSystems, which finds all systems in a given group. The last parameter,
'true' determines whether to search all subgroups. In this example, this parameter is set to true,
the command iterates through all systems found under Lost&Found and any of its subgroups, then
reapplies the sorting rules to those systems.
ePolicy Orchestrator remote commands allow you to query your database remotely using the web API.
These commands allow you to execute persistent queries, which exist in the ePolicy Orchestrator
database, as well as dynamic user-defined ad-hoc queries.
Contents
Persistent queries
Ad-hoc queries
Queries with joins
Remote query commands
Ad-hoc query reference
Persistent queries
A persistent query is accessible using the Queries and Reports page in the ePolicy Orchestrator user
interface.
Persistent queries include both pre-installed queries and queries you create. You must know the query
ID to remotely execute a persistent query.
Query examples
In all of these query examples, the first two lines of the example contain the URL and Python forms of
the command. For example, the examples of the core.listQueries command appear as:
URL: https://servername:port/remote/core.listQueries
Python: mc.core.listQueries();
The URL example could be typed directly into your browser address bar as:
https://localhost:8443/remote/core.listQueries
Or, the URL example could be used with a cURL command as:
> curl -k -u ga:ga https://localhost:8443/remote/core.listQueries
Use the core.listQueries command to find the ID of any persistent query that you can access.
URL: https://servername:port/remote/core.listQueries
Python: mc.core.listQueries();
OK:
Id: 1
Name: Effective permissions for users
Description: Shows all the permissions for each user
Criteria: ( where ( ne EntitlementView.RoleUri "%%NOEPOROLES%%" ) )
Group Name: Permission Queries
Owner: ga
Database Type:
Target: EntitlementView
Created by: ga
Created on: 10/25/10 8:40:33 AM PDT
Modified by: ga
Modified on: 10/25/10 8:40:33 AM PDT
Id: 2
Name: Permission set details
Description: Shows the permissions associated with each permission set
URL: https://servername:port/remote/core.executeQuery?queryId=5
Python: mc.core.executeQuery('5');
OK:
User Name: ga
Action: Create Response
Success: true
Start Time: 10/26/10 9:00:24 AM PDT
User Name: ga
Action: Create Response
Success: true
Start Time: 10/26/10 9:00:24 AM PDT
Ad-hoc queries
Ad-hoc queries are performed entirely remotely and do not rely on a query stored in an ePolicy
Orchestrator database.
In an ad-hoc query, you specify the target of the query and up to four of the parameters in this table.
URL: https://servername:port/remote/core.executeQuery?target=OrionAuditLog&select=(select
OrionAuditLog.UserName OrionAuditLog.CmdName)
OK:
User Name:
Action: Server restart
User Name: ga
Action: Login attempt
User Name: ga
Action: Upload Extension
This query returns the CmdName and EndTime for all audit log entries. The results are grouped
alphabetically by the CmdName, then by the EndTime.
OK:
User Name: ga
Priority: 1
Action: Login attempt
Details: Failed logon for user "ga" from IP Address: 172.1.6.1
Success: false
Start Time: 10/11/12 4:41:18 PM PDT
Completion Time: 10/11/12 4:41:18 PM PDT
This query returns all OrionTaskLog entries the "ga" user created. The results are listed in ascending
order of the task StartDate.
OK:
Name: Deploy McAfee Agent
Start Date: 10/11/12 5:00:01 PM PDT
End Date: 10/11/12 5:00:38 PM PDT
User Name: ga
Status: 0
Source: scheduler
Duration: 36846
Example
This is a typical exported query definition:
<query>
<name language="en">My AuditLogQuery</name>
<description language="en"></description>
<property name="target">OrionAuditLog</property>
<property name="tableURI">query:table?orion.table.columns=OrionAuditLog.UserName
%3AOrionAuditLog.CmdName%3A
OrionAuditLog.Success
%3AOrionAuditLog.StartTime&orion.table.order.by=OrionAuditLog.CmdName
&orion.table.order=asc</property>
<property name="conditionURI">query:condition?orion.condition.sexp=%28+where+%28+olderThan+
OrionAuditLog.EndTime+3600000++%29+%29</property>
<property name="summaryURI">query:summary?
orion.sum.query=false&orion.query.type=table.table</property>
</query>
• The conditionURI attribute contains the S-Expression to use as the where parameter.
In an S-expression, the SELECT clause mirrors the limitations of a SELECT SQL clause. The SELECT
clause operations include columns and unary operations on table columns. For example, Count, Max,
Top, and others.
The unary operators work on only one expression of any one of the data types of the numeric data
type category. For example, you cannot use SUM, or any other aggregate operations, with SELECT.
The best way to become familiar with what SELECT clause arguments are supported, and their
limitations in an ad-hoc query S-expression, is to export queries and examine their structure.
Remember that the exported form of the query contains strings that are URL-encoded. To form a valid
query string, decode the URL-encoded characters. For example:
This is the equivalent ad-hoc URL query using the exported query definition:
https://servername:port/remote/core.executeQuery?target=OrionAuditLog&select=(select
OrionAuditLog.UserName OrionAuditLog.CmdName OrionAuditLog.Success
OrionAuditLog.StartTime)&where=(where(olderThan OrionAuditLog.EndTime
36000000))&order=(order(asc OrionAuditLog.CmdName))
This is the equivalent ad-hoc Python query using the exported query definition:
mc.core.executeQuery(target="OrionAuditLog",
select="(select OrionAuditLog.UserName OrionAuditLog.CmdName OrionAuditLog.Success
OrionAuditLog.StartTime)",
where="(where(olderThan OrionAuditLog.EndTime 36000000))",
order="(order(asc OrionAuditLog.CmdName))");
OK:
User Name: ga
Priority: 1
Action: Login attempt
Details: Failed logon for user "ga" from IP Address: 172.1.5.1
Success: false
Start Time: 10/11/12 4:41:18 PM PDT
Completion Time: 10/11/12 4:41:18 PM PDT
Example output
This output is from the core.listTables command run on the OrionAuditLog table.
You can use the core.listTables command to list the columns, their types, whether the column can
be used in the select, condition, group or order parameters, and whether the column is a number.
The command also lists any registered related tables that can be joined with the joinTables
parameter.
In general, when issuing queries against targets that are not part of the default schema, prepend the
database name to the target. For example, to reference an "OutsidePolicy" target that is part of an
"Outsider" database, you would use the identifier "target=Outsider.OutsidePolicy".
An error appears if there is no join information registered for the tables when the query runs.
You can use the core.listTables command to determine which tables are related and are capable of
participating in joins. The relatedTables table property contains this join information.
URL: https://servername:port/remote/core.executeQuery?
target=OrionTaskLogTaskMessage&select=(select OrionTaskLogTask.Name
OrionTaskLogTaskMessage.Message )&joinTables=OrionTaskLogTask
OK:
Name: New Task
Message: Purge audit log
The core.executeQuery command can also be used in joinTables mode. In this mode, you specify
only the tables you want joined. The results of the query are used as keys to perform a subquery for
all related results from the joined table. The joined table creates a hierarchical result set that could
contain nested results. The nested results level depends on how many join tables are specified.
To join tables using core.executeQuery, you specify a comma-separated list of tables to join as the
joinTables parameter. You do not specify a select parameter when joining tables. The results are
returned as a result hierarchy with each record of the parent table becoming the parent node of the
related records in each child table. The hierarchy continues until all joined tables are displayed.
Example
This example executes a simple join between the OrionTaskLog and the OrionTaskLogMessage
tables.
OK:
<?xml version="1.0" encoding="UTF-8"?>
<result>
<list>
<row>
<OrionTaskLogTask.Name>New Task</OrionTaskLogTask.Name>
<OrionTaskLogTask.StartDate>2010-11-23T13:01:37-08:00</OrionTaskLogTask.StartDate>
<OrionTaskLogTask.EndDate>2010-11-23T13:01:37-08:00</OrionTaskLogTask.EndDate>
<OrionTaskLogTask.UserName>ga</OrionTaskLogTask.UserName>
<OrionTaskLogTask.Status>0</OrionTaskLogTask.Status>
<OrionTaskLogTask.TaskSource>scheduler</OrionTaskLogTask.TaskSource>
<OrionTaskLogTask.Duration>493</OrionTaskLogTask.Duration>
<OrionTaskLogTaskMessage>
<list>
<row>
<OrionTaskLogTaskMessage.Message>Purge audit log</OrionTaskLogTaskMessage.Message>
</row>
<row>
<OrionTaskLogTaskMessage.Message>Purge audit log (Purge log records older than: 1
days)</OrionTaskLogTaskMessage.Message>
</row>
</list>
</OrionTaskLogTaskMessage>
</row>
</list>
</result>
This output shows the core.executeQuery command returned each top-level object (the
OrionTaskLogTask record) and its two associated message records. The output is shown as XML to
highlight the hierarchical arrangement of the results.
the result depth by one. To prevent result sets from becoming too deep, the core.executeQuery
command defaults to a maximum depth of 5 levels. If this default limit is too restrictive for the query
being run, you can change it with a new value for the depth parameter.
Ad-hoc queries that return deep result sets can take a long time to run and can consume many system
resources to generate. You should consider this when joining more than two tables, or increasing the
query result depth limit.
Specify arguments followed by "=<>" by name. For example, the argument "target=" must be included
in the command, core. For example, executeQuery?target=EntitlementView
The data types and types of columns in a target can be determined using the core.listTables
command.
These tables provide these basic elements and examples of their use.
These tables show operators you can use on S-expressions to define queries.
If you use an order clause with select distinct, include the order columns in the
selection.
Top N Selects the first N records to display. N must be (select (top 5) OrionTaskLogTask
an integer. Similar to the Microsoft SQL Top, or .Name OrionTaskLogTask
the MySQL Limit clause. .StartDate)
A commands (continued)
system.deployAgent 16
about this guide 5
system.find 16, 22
authentication 13
system.findGroups 10, 24, 25
C system.importSystem 16
system.report 25
commands
system.setUserProperties 16
clienttask.export 25
system.wakeupAgent 16, 22
clienttask.importClientTask 25
tasklog.purge 16
clienttask.run 16
conventions and icons used in this guide 5
commonevent.purgeEvents 16
cURL
core.addPermSetsForUser 16
example using 9, 10
core.addUser 16
syntax 7
core.executeQuery 16, 27, 30, 32–34
core.exportPermissionSets 16
core.help 9, 14, 16
D
core.importPermissionSets 16 datatypes
core.listDatabases 16, 28, 31, 34 ePolicy Orchestrator-specific 38
core.listDatatypes 28, 34 ePolicy Orchestrator-specific operator combinations 39
core.listQueries 16, 27, 34 reference 35, 38
core.listTables 16, 28, 31, 32, 34 S-expression operator combinations 37
core.listUsers 23 discover commands
core.purgeAuditLog 16 Python client 14
core.removeUser 23 URLs 9
core.updateUser 16 documentation
detectedsystem.add 24 audience for this guide 5
detectedsystem.addToTree 24 product-specific, finding 6
dir 14 typographical conventions and icons 5
epogroup.findSystems 25
help 14 E
mcafee.client 13
examples
policy.assignToGroup 10
assigning policies 10
policy.assignToSystem 16
automating repetitive tasks 22
policy.export 25
automating user management 23
policy.find 10, 16, 25
importing and exporting 25
policy.importPolicy 25
importing computers 24
repository.checkInPackage 16
introduction 21
repository.find 16
introductory 21
repository.pull 16
System Tree maintenance 25
scheduler.cancelServerTask 16
URL use 10
scheduler.listRunningServerTasks 13
scheduler.runServerTask 16
system.applyTag 16, 21
system.delete 16
H queries (continued)
executing persistent 27
help
joining tables 32, 33
retrieving command listings 9
joinTable argument 33
obtaining database information 31
I
obtaining table information 31
introduction operator reference 34
examples 21 operators used with S-expressions 35
order argument 30
K performing ad-hoc 28
persistent 27
key commands 16
select argument 30, 32
specifying tables to join 33
M
trimming result sets 33
McAfee ServicePortal, accessing 6
where argument 30
O
R
operators
requirements
ePolicy Orchestrator -specific datatype combinations 39
Python client 12
ePolicy Orchestrator specific 38
scripts 13
reference 38
S-expression datatype combinations 37
S-expression reference 35 S
output type S-expression in ad-hoc queries 30
JSON 7 S-expressions
terse 7 operator reference 35
verbose 7 operators used with datatypes 37
XML 7 ServicePortal, finding product documentation 6
P T
parameter notes 12 Technical Support, finding product information 6
password security 13
Python client U
authenticating 13 URLs
discovering commands 14 discovering commands through 9
importing into a script 13
script requirements 13
W
software requirements 12
web API
using 12
basics 7
calling with URLs 7
Q
controlling output locale 7
queries introduction 7
ad-hoc 28 output formats 7
ad-hoc example created from query definition 30 overview 7
ad-hoc reference 34 retrieving files with curl 7
commands used in remote queries 34 return types 10
datatype reference 35 wget 7
example ad-hoc query 28