Example 2: Automate repetitive tasks on managed systems

You can take a tag name for input and send a McAfee Agent wake-up call to all systems having that tag with this example script.

#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.

Note: 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."

This script uses the EPOComputerProperties.ParentID property to send to the system.wakeupAgent command, but since that command also takes a name, that line could have been written as:

id = system['EPOComputerProperties.ComputerName']

Note: 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.