4 Replies Latest reply on May 27, 2010 7:02 PM by mgx

    SQL script to move specified systems to a specific folder?

      I know that you can't run a query or filter a list of systems you want to perform a batch operation on such as moving all systems apart of a list to a certain folder, however I do know that with the system name list in handy, you can inject them into the database table directly and have them moved the unconventional way. Can someone please elaborate on this and help me to be able to perform this query on my ePO sql server?

       

      Running ePO 4.0

        • 1. Re: SQL script to move specified systems to a specific folder?
          JoeBidgood

          You can do what you're describing in ePO 4.5, I believe, if you set up a server task - there is a "move systems to another group" action that should do the trick.

           

          Please don't try shifting things around in the database directly as we won't be able to support you if you do

           

          Regards -

           

          Joe

          • 2. Re: SQL script to move specified systems to a specific folder?

            Lets hypothetically assume that 1) ePO support as far as commercial support is already invalid or warranty has expired in some way shape or form, and that 2) the actions referenced to above will only be performed on a sandbox environment where experimental changes like this are required to be learned as part of requisities to supporting this product. Given the circumstances outlined above, would someone mind showing an example of what a query might look like if they were required to perform this action and be able to do this?

             

             

            Message was edited by: mgx on 5/25/10 6:56:18 PM CDT

             

             

            Message was edited by: mgx on 5/25/10 6:57:21 PM CDT
            • 3. Re: SQL script to move specified systems to a specific folder?

              If someone was that foolish, brave and mad at the same time they would have to run a query like this:

               

              UPDATE EPOLeafNode
              SET ParentID = (SELECT AutoID FROM EPOBranchNode WHERE NodeName = 'TargetFolderName')
              WHERE NodeName IN ( 'Computer1','Computer2', ... ,'ComputerX' )

               

              Substitute NodeTextPath2 for NodeName when selecting the folder ID if the node names aren't unique, e.g.:

              (SELECT AutoID FROM EPOBranchNode WHERE NodeTextPath2 = '\RootFolder\SubFolder\TargetFolderName')

               

              If they then wanted to be extra nice they would also insert an audit record:

               

              INSERT INTO OrionAuditLog... (the rest intentionally left blank as an excersice for the reader)

               

               

              Matt

              • 4. Re: SQL script to move specified systems to a specific folder?

                thank you VERY MUCH for your example here, it will help a lot in my future endeavors with SQL!