1 2 Previous Next 10 Replies Latest reply on May 4, 2015 3:49 PM by llamamecomoquieras

    API to add system to system tree in ePO

    llamamecomoquieras

      Hi,

       

      I am trying to get the script to add machines into the system tree in epo. I have done one to delete machines from system tree and another to check if a machine exist in ePO and return all the properties from the machine from ePO

       

      I have found the following in the epo api scripting guide but it doesnt work

       

      #Example 4

      import mcafee, sys,inspect

      mc=mcafee.client('localhost','8443','admin','password')

       

       

      file = open('C:/myfile.txt', 'r')

      for line in file:

      #determine the ID of the group to add it to

      groups = mc.system.findGroups(line.rstrip('\n'))

      groupId = -1

      for group in groups:

       

        if group['groupPath'] == 'My Organization\TEST':

         groupId = group['groupId']

       

       

      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=sysPr ops[2],domain=sysProps[3])

       

      mc.detectedsystem.addToTree(str(systemId),str(groupId))

       

      Any help???

       

      Best regards,

       

      Jose

        1 2 Previous Next