2 Replies Latest reply on Jul 2, 2013 11:46 AM by atheodor

    System names and ids

    atheodor

      I am using the python implementation of the webAPI for clarification.

       

      system.delete

      system.deployAgent

      system.move

      system.resort

      system.setUserProperties

      system.transfer

      system.wakeupAgent

       

      I am trying to create an automated response to deal with machines with duplicate names by deleting the non-existant entry.  All of these commands take either a system name or id (or a comma separated list).  I can use these commands with system names, but this runs the command against ALL machines that have that system name.  I'm having a very difficult time determining what "id" is being used for uniquely identifying machines to avoid this issue.  I have tried using ParentID, HostID, and AgentGUID, but none of these values resolve to a machine to take action on.  None of the documentation that I've gone through seems to give me an idea of what "id" is.  I'm scraping through SQL tables trying to find any columns that are labeled "id" and trying to use them, but no luck.

       

      When I run the wakeupAgent command, I receive this response.

          No systems found to wake up.  Please enter valid computer ids/names.

       

      Any help is appreciated.

        • 1. Re: System names and ids
          mingle1

          I am using Powershell so my syntax is a bit different but the core information should work.

           

          The ParentID is what you are looking for.

           

          This is directly from the WebAPI Scripting Guide

           

           

          #Example 2

          import mcafee

          mc = mcafee.client('localhost','8443','ga','ga', 'https','json')

          input = sys.argv[1] #input to the script, our tag name

          systems = mc.system.find(input)

          # JSON data structures map to Python data types:

          for system in systems:

          id = system['EPOComputerProperties.ParentID']

          result = mc.system.wakeupAgent(id)

           

           

          I found the ParentID with System.Find (It may be named System Location: ) and ran System.wakeupAgent?ids={ParentID} and it returned a completed wakeup.

           

           

          [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}$url = "https://{servername}:{port}/remote/system.wakeupAgent?ids=9220"
          $navigate = new-object System.Net.WebClient 
          $navigate.credentials = New-Object system.net.NetworkCredential($user, $password, $domain)
          $navigate.DownloadString("$url")
          OK:
          completed: 1
          failed: 0
          expired: 0 
          
          
          
          • 2. Re: System names and ids
            atheodor

            My script had erroneously been converting all values to strings, I had never noticed it until I ran it verbatim.  I've been searching for system names that were a string a numbers.  However, now I'm getting an error from mcafee.py.  I'm going to investigate it (as it's a new problem), but I'll post it here in the meantime.

             

            >>> mc.system.wakeupAgent(a[0]['EPOComputerProperties.ParentID'])

            Traceback (most recent call last):

              File "<stdin>", line 1, in <module>

              File "C:\Python27\Lib\mcafee.py", line 446, in __call__

                return self.invoker.invoke(self.prefix + '.' + self.name, argmap)

              File "C:\Python27\Lib\mcafee.py", line 271, in invoke

                if arg[:8] == 'file:///':

             

            Thanks for the help, I appreciate your time.

             

            Message was edited by: atheodor on 7/2/13 11:46:37 AM CDT