Example 3: Automate user management

You use this script to search through all ePolicy Orchestrator users and deletes any marked as "disabled" if they are not administrators.

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.

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

Human readable Machine readable
MFS authentication pwd
Certificate Based Authentication cert
Windows authentication ntlm